Re: REST, how about 'Login' map

2020-09-30 Thread Girish Vasmatkar
Hi Hans,

This is now implemented/fixed with commit8545cfe

 .

Best,
Girish
HotWax Systems


On Tue, Sep 29, 2020 at 5:26 PM Hans Bakker 
wrote:

> Hi Girish, thanks for your prompt reply,
>
> the login map need to be filled when the related token is available, what
> is currently not the case.
>
> Not sure if this is directly related to the Auth=false parameter, you know
> that better,
>
> Regards, Hans
> On 9/29/20 4:20 PM, Girish Vasmatkar wrote:
>
> Hi Hans
>
> Since you specifically mentioned about groovy service, I would think it is
> true for other services as well.
>
> It would possibly be happening, if the service itself is declared with
> auth=false, so no token check is happening and hence userLogin is not
> retrieved from the token.
> Can you confirm if this is the case? The userLogin is added to the service
> call before delegating the service call to dispatcher after jwt has been
> verified. But in case of auth=false, services, auth is bypassed and hence
> userLogin is not set.
>
> I guess the key here is to bypass token validation if, and only if, the
> Authorization header is absent, otherwise perform validation. I had a
> discussion about this with Jacopo as well and here is what can be done
> (applicable for */services *endpoint ) -
>
> If auth=false and *Authorization* header is *present*, validate token and
> return error if invalid. Else set userLogin in context and delegate the
> call to dispatcher.
> If auth=false and *Authorization* header is *absent, *just call the
> service. The service will be executed *without* userLogin in context.
>
> I will try to work on this change in the next couple days.
>
> Best,
> Girish
> HotWax Systems
>
>
>
>
>
>
>
>
>
>
>
> Best,
> Girish
> HotWax Systems
>
>
>
>
>
>
>
>
> On Tue, Sep 29, 2020 at 6:20 AM Hans Bakker 
> wrote:
>
>> Hi Girish,
>>
>> thanks for your last email, that is working now too
>>
>> howeveranother question,
>>
>> If i call a service using the token i obtained earlier, i see that the
>> userLogin map in the groovy service I called, is null
>>
>> can you set the login map to the userLogin of the token that was used so
>> we know who the user is?
>>
>> Thanks, Hans
>>
>>
>>


Need input on extending the Uom Related seed data

2020-09-30 Thread Development

Hey everyone.  I would like to contribute to trunk some more Uom (Uom, 
UomType, UomConversion) seed data, and some more demo records that use Uom 
data.  I have found 2 issues that I will need input on before I can make a real 
proposal.




ISSUE #1:
There is a uomTypeId="TIME_FREQ_MEASURE".  However, the frequency units 
have not been added to that.  I will add the frequencies, but i suspect they 
have not been added yet because there is no way to convert between time and 
frequency.


It looks like UomConversion seems to assume that all conversions are of 
type:
   measured_value_uomIdTo = (conversionFactor * measured_value_uomIdFrom)

Are there plans to someday extend UomConversion, perhaps to be something 
more allong the lines of:
   measured_value_uomIdTo = conversionZeroOffset + (conversionFactor * 
(measured_value_uomIdFrom ^ conversionExponent))

(This example would accommodate both frequency and the "how do i express  1 
F = 1.8C + 32 ?" issue in the comments of UnitData.xml).

1 F = 32 + 1.8 * (C ^ 1)
1 Hz (frequency) = 0 + 1 * (second ^ -1)


So my issue #1 is: Are there plans for extending the UomConversion entity 
to be able to handle more in the future?  If not, then I propose the 
frequencies should be moved to their own UomType, like:





Issue #2:
Now there is a service "convertUom" in 
component://common/groovyScripts/CommonServices.groovy that handles conversions.
From glancing at it, I don't think it does either recursive or join 
searches for UomConversion yet (note, join searches are not appropriate for 
UomConversionDated as things like currencies can get out of wack during 
arbitrage opportunities so that converting from A to B, then B to C, then C to 
A can yeild a profit.

If the convertUom service does not do either yet, then I propose it would 
be best to enter conversion factors for "single join" searches in preparation 
for the day convertUom gets extended.
























(Note: The current seed data tends to use this form)

So my issue #2 is:
Has some decision been made that in the future we should go with "recursive 
searches"?
(For example, does the "convertUom" in 
component://common/groovyScripts/CommonServices.groovy already do, or is it 
planned to be able to do recursive searches?  If so then I should do it the 
recursive way.
Otherwize I think I should do it the "join" way.

Thoughts?






CONFIDENTIALITY NOTICE: This message is intended only for the use of the person 
or organization to which it is addressed or was intended to be addressed, and 
may contain information that is privileged, confidential and exempt from 
disclosure under applicable law. If the reader of this message is not the 
intended recipient, or responsible for delivering the message to the intended 
recipient, you are hereby notified that any dissemination, distribution or 
copying of this communication is strictly prohibited. If you have received this 
communication in error, please notify the sender immediately by email and 
delete the original message immediately . The sender, its subsidiaries and 
affiliates, do not accept liability for any errors, omissions, corruption or 
virus in the contents of this message or any attachments that arise as a result 
of e-mail transmission. Thank you.


OFBiz REST implementation session #2 (10/07/2020)

2020-09-30 Thread Girish Vasmatkar
Hi Everyone!

Please find details of the next session I am planning to hold on OFBiz REST
implementation. This will have some hands-on examples that will help
everyone using it.

Date :  10/07/2020
Time :  4 PM IST, 12:30 PM CET
Meeting URL : TBD, I will send the invite link the day before.
Agenda :

1. Preconfigured Resources (Resources that come OTB)

   -

   Authentication Token Generating Resource (How to invoke and example
   usage)
   -

  POST /auth/token
  -

   Exportable Services Resource (How to call services with export=true via
   REST interface with example usage)
   -

  GET | POST | PUT | DELETE | PATCH /services/{serviceName}
  -

  GET vs POST service in parameters difference. How to invoke service
  defined as GET vs POST | POST | PATCH.
  -

   OpenAPI Resource
   -

  GET /openapi.json
  -

  GET /openapi.yaml
  -

   WADL Resource (WADL is to REST as  WSDL is to SOAP)
   -

  GET /application.wadl

2.  Standard API responses supported for various use cases (with examples)
and how to interpret them.

   -

   HTTP 200 OK
   -

   HTTP 400 Bad Request
   -

   HTTP 401 Unauthorized
   -

   HTTP 403 Forbidden
   -

   HTTP 422 Unprocessable Entity
   -

   HTTP 405 Method Not Allowed
   -

   HTTP 406 Not Acceptable
   -

   HTTP 415 Unsupported Media Type

3. Content Negotiation (JSON)

   -

   Accept : application/json
   -

   Content-Type : application/json

4. Q session

Best,
Girish Vasmatkar


Re: OFBiz Integrations

2020-09-30 Thread Rodrigo Lima
8) OAuth2 (Facebook, Linkedin, Twitter, SAML etc)

Em ter., 29 de set. de 2020 às 19:14, Rishi Solanki 
escreveu:

> Dear All,
> In another thread on "Integration with facebook ecommerce platform" one
> good suggestion came from user Andrew Williams to integrate OFBiz with
> WooCommerce and WordPress. I would like to extend it to all required
> integrations.
>
> Below are the areas as per my understanding where we would require
> integrations which is in general expected.
>
> 1) Payment (Amazon, Apple, PayPal, First Data etc)
> 2) Shipping (UPS, UPS, FEDEX, DHL etc.)
> 3) Other Selling Portals and Channels (Amazon, WooCommerce, Wordpress,
> Shopify etc.)
> 4) Communication related integration. (Email, SMS, Chatbot, Whatapp etc)
> 5) Supporting modules like Reports tool, Sales Force etc.
> 6) Data Import Tool like JSON, Excel, CSV etc.
>
> Please add more in the list. Once will have all items listed, we will push
> that list over the confluence page, and all supporting docs link. Later we
> can pick one by one and mark them complete from there, in this way from the
> open list everyone will have the opportunity to pick any and contribute.
>
> We can also think of creating open tickets from the approved list to work
> on. Looking forward.
>
> Rishi Solanki
> *CTO, Mindpath Technology*
> Intelligent Solutions
> cell: +91-98932-87847
> http://www.mindpathtech.com
> LinkedIn 
>


Re: XML to Groovy conversions

2020-09-30 Thread Jacques Le Roux

Hi Suraj,

Thanks for your suggestions, I want to add an obvious one:

Please test your changes, at least manually or by adding JUnit tests.

OFBIZ-11986 is a good example of what needs to be done else after  :/

I was actually looking for a recent more complaining message on the same subject but I could not spot it. I guess I confused with your which is not 
really complaining :)


Jacques

Le 16/05/2020 à 09:30, Suraj Khurana a écrit :

Hello team,

Recently we are working on a major refactoring task of minilnag to groovy
conversion, which is commendable. I would like to add following points to
be taken into consideration while doing the exact changes in the service:

- Check and think of possible conversion to entity-auto.
- Handle service error responses, in xml usually we skip it. It would be
great if while conversion if any service is called, its error response
should be effectively handled. Like in a single line:

serviceResult = run service: "createCustomer", with: parameters
if (!ServiceUtil.isSuccess(serviceResult)) return
error(serviceResult.errorMessage)

- Avoid unnecessary declaration of variables and the same 'serviceResult'
map can be re-used in case of multiple service calls inside the same
service.

IMO, these are very small best practices that can directly be taken care of
while conversion, will improve code quality.

Please share your thoughts on this.

--
Best Regards,
Suraj Khurana
Senior Technical Consultant




Re: OFBiz Integrations

2020-09-30 Thread Pierre Smits
I second that.

Mvg

Pierre

Op wo 30 sep. 2020 11:38 schreef Pritam Kute :

> Thanks, Rishi for sharing this.
>
> We have already started work on moving all custom integrations as a
> separate plugin from the framework component. Alongside we will be working
> on checking if the integrations are updated and working as expected. I feel
> that this will be a good step to add a page on confluence which will become
> a single point of reference for all available integrations in the Apache
> OFBiz.
>
> Kind Regards,
> --
> Pritam Kute
>
>
> On Wed, Sep 30, 2020 at 3:44 AM Rishi Solanki 
> wrote:
>
> > Dear All,
> > In another thread on "Integration with facebook ecommerce platform" one
> > good suggestion came from user Andrew Williams to integrate OFBiz with
> > WooCommerce and WordPress. I would like to extend it to all required
> > integrations.
> >
> > Below are the areas as per my understanding where we would require
> > integrations which is in general expected.
> >
> > 1) Payment (Amazon, Apple, PayPal, First Data etc)
> > 2) Shipping (UPS, UPS, FEDEX, DHL etc.)
> > 3) Other Selling Portals and Channels (Amazon, WooCommerce, Wordpress,
> > Shopify etc.)
> > 4) Communication related integration. (Email, SMS, Chatbot, Whatapp etc)
> > 5) Supporting modules like Reports tool, Sales Force etc.
> > 6) Data Import Tool like JSON, Excel, CSV etc.
> >
> > Please add more in the list. Once will have all items listed, we will
> push
> > that list over the confluence page, and all supporting docs link. Later
> we
> > can pick one by one and mark them complete from there, in this way from
> the
> > open list everyone will have the opportunity to pick any and contribute.
> >
> > We can also think of creating open tickets from the approved list to work
> > on. Looking forward.
> >
> > Rishi Solanki
> > *CTO, Mindpath Technology*
> > Intelligent Solutions
> > cell: +91-98932-87847
> > http://www.mindpathtech.com
> > LinkedIn 
> >
>


Re: OFBiz Integrations

2020-09-30 Thread Pritam Kute
Thanks, Rishi for sharing this.

We have already started work on moving all custom integrations as a
separate plugin from the framework component. Alongside we will be working
on checking if the integrations are updated and working as expected. I feel
that this will be a good step to add a page on confluence which will become
a single point of reference for all available integrations in the Apache
OFBiz.

Kind Regards,
--
Pritam Kute


On Wed, Sep 30, 2020 at 3:44 AM Rishi Solanki 
wrote:

> Dear All,
> In another thread on "Integration with facebook ecommerce platform" one
> good suggestion came from user Andrew Williams to integrate OFBiz with
> WooCommerce and WordPress. I would like to extend it to all required
> integrations.
>
> Below are the areas as per my understanding where we would require
> integrations which is in general expected.
>
> 1) Payment (Amazon, Apple, PayPal, First Data etc)
> 2) Shipping (UPS, UPS, FEDEX, DHL etc.)
> 3) Other Selling Portals and Channels (Amazon, WooCommerce, Wordpress,
> Shopify etc.)
> 4) Communication related integration. (Email, SMS, Chatbot, Whatapp etc)
> 5) Supporting modules like Reports tool, Sales Force etc.
> 6) Data Import Tool like JSON, Excel, CSV etc.
>
> Please add more in the list. Once will have all items listed, we will push
> that list over the confluence page, and all supporting docs link. Later we
> can pick one by one and mark them complete from there, in this way from the
> open list everyone will have the opportunity to pick any and contribute.
>
> We can also think of creating open tickets from the approved list to work
> on. Looking forward.
>
> Rishi Solanki
> *CTO, Mindpath Technology*
> Intelligent Solutions
> cell: +91-98932-87847
> http://www.mindpathtech.com
> LinkedIn 
>


Re: OFBiz REST session

2020-09-30 Thread Girish Vasmatkar
Hello Pierre

Apparently I missed the most important part, I thought I had mentioned
"today", but unfortunately I didn't. Apologies for that. Please do join, if
you can, today @ 4 PM IST, 10:30 AM GMT.

Future sessions will be sent notifications for well in advance.

Best Regards,
Girish


On Wed, Sep 30, 2020 at 2:26 PM Pierre Smits  wrote:

> Hi Girish,
>
> Which date will this be?
>
>
> Met vriendelijke groet,
>
> Pierre Smits
> *Proud* *contributor** of* Apache OFBiz  since
> 2008 (without privileges)
>
> *Apache Trafodion , Vice President*
> *Apache Directory , PMC Member*
> Apache Incubator , committer
> Apache Steve , committer
>
>
> On Wed, Sep 30, 2020 at 10:13 AM Girish Vasmatkar <
> girish.vasmat...@hotwaxsystems.com> wrote:
>
> > Hi All
> >
> > We will be holding an introductory session on *ofbiz-rest-impl* plugin @
> 4
> > PM IST, 10:30 AM GMT. Agenda for the same is as follows -
> >
> > 1. Introduction to ofbiz-rest-impl 2. Technology stack used 3. Q
> session
> >
> > Here's the meet URL for everybody's reference :
> > https://meet.google.com/mjt-rich-suo . Please do join.
> >
> > Best Regards,
> > Girish
> >
>


OFBiz REST session

2020-09-30 Thread Girish Vasmatkar
Hi All

We will be holding an introductory session on *ofbiz-rest-impl* plugin @ 4
PM IST, 10:30 AM GMT. Agenda for the same is as follows -

1. Introduction to ofbiz-rest-impl 2. Technology stack used 3. Q session

Here's the meet URL for everybody's reference :
https://meet.google.com/mjt-rich-suo . Please do join.

Best Regards,
Girish


Re: [PROPOSAL] Separate login service for API calls

2020-09-30 Thread Girish Vasmatkar
I've created https://issues.apache.org/jira/browse/OFBIZ-12033 for the
same. Thank you, all.

Best,
Girish
HotWax Systems

On Tue, Sep 29, 2020 at 1:39 PM Mridul Pathak 
wrote:

> +1
>
> Thanks.
> Mridul Pathak
>
> On Tue, Sep 29, 2020 at 1:29 PM Michael Brohl 
> wrote:
>
> > +1
> >
> > With an addition: we should do the implementation in a way that the
> > user/password matching is implemented only once and used in both login
> > methods (not just copy & paste into another method).
> >
> > It might take some refactoring to pull these part out of the login event.
> >
> > Best regards,
> >
> > Michael Brohl
> >
> > ecomify GmbH - www.ecomify.de
> >
> >
> > Am 29.09.20 um 09:43 schrieb Jacopo Cappellato:
> > > +1
> > >
> > > Jacopo
> > >
> > > On Sat, Sep 26, 2020 at 6:35 AM Girish Vasmatkar <
> > > girish.vasmat...@hotwaxsystems.com> wrote:
> > >
> > >> Hi
> > >>
> > >> I am using userLogin service to authenticate users before generating
> > auth
> > >> tokens for REST API and GraphQL calls. However, I figured that a
> > session is
> > >> also getting created and returned in response which is defeating the
> > >> purpose of having an API in place. Even though that session is not
> > getting
> > >> used anywhere when subsequent calls are made using the token, I still
> > think
> > >> it is an extra session lying around in tomcat's session cache.
> > >>
> > >> I propose to implement a new basic userLogin service
> > (basicAuthUserLogin)
> > >> that would just do username/password matching and be done with it
> > without
> > >> ever calling request.getSession(). This will ensure that APIs are
> > stateless
> > >> and no session is generated.
> > >>
> > >> Anything else you think should be part of the new service instead of
> > just
> > >> username/password validation?
> > >>
> > >> Best,
> > >> Girish
> > >> HotWax Systems
> > >>
> >
> >
>