You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/11/22 11:23:13 UTC

svn commit: r883056 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelServiceReader.java service/src/org/ofbiz/service/ServiceDispatcher.java widget/src/org/ofbiz/widget/form/ModelForm.java

Author: jacopoc
Date: Sun Nov 22 10:23:09 2009
New Revision: 883056

URL: http://svn.apache.org/viewvc?rev=883056&view=rev
Log:
New improved version of an enhancement to the service framework after I reverted my first one because it was causing some issues with service validations.
Added two new IN parameter, internally (and automatically) set for service definitions:
login.username
login.password
They are already used by the authorization service ("userLogin") to authorize the user to the service call and to retrieve the userLogin object (if the user is authorized).
They can be passed to the service in the input context in place of the userLogin object: this is useful when the service is invoked from a remote system (thru SOAP etc...).


Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=883056&r1=883055&r2=883056&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Sun Nov 22 10:23:09 2009
@@ -642,6 +642,22 @@
         def.optional = true;
         def.internal = true;
         service.addParam(def);
+        // login.username
+        def = new ModelParam();
+        def.name = "login.username";
+        def.type = "String";
+        def.mode = "IN";
+        def.optional = true;
+        def.internal = true;
+        service.addParam(def);
+        // login.password
+        def = new ModelParam();
+        def.name = "login.password";
+        def.type = "String";
+        def.mode = "IN";
+        def.optional = true;
+        def.internal = true;
+        service.addParam(def);
         // Locale
         def = new ModelParam();
         def.name = "locale";

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=883056&r1=883055&r2=883056&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Sun Nov 22 10:23:09 2009
@@ -863,11 +863,11 @@
             return context;
         }
 
-        if (context.containsKey("login.username")) {
+        if (UtilValidate.isNotEmpty(context.get("login.username"))) {
             // check for a username/password, if there log the user in and make the userLogin object
             String username = (String) context.get("login.username");
 
-            if (context.containsKey("login.password")) {
+            if (UtilValidate.isNotEmpty(context.get("login.password"))) {
                 String password = (String) context.get("login.password");
 
                 context.put("userLogin", getLoginObject(service, localName, username, password, (Locale) context.get("locale")));

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=883056&r1=883055&r2=883056&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sun Nov 22 10:23:09 2009
@@ -679,7 +679,7 @@
 
         for (ModelParam modelParam: modelService.getInModelParamList()) {
             // skip auto params that the service engine populates...
-            if ("userLogin".equals(modelParam.name) || "locale".equals(modelParam.name) || "timeZone".equals(modelParam.name)) {
+            if ("userLogin".equals(modelParam.name) || "locale".equals(modelParam.name) || "timeZone".equals(modelParam.name) || "login.username".equals(modelParam.name) || "login.password".equals(modelParam.name)) {
                 continue;
             }
             if (modelParam.formDisplay) {



Re: svn commit: r883056 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelServiceReader.java service/src/org/ofbiz/service/ServiceDispatcher.java widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
> On Dec 3, 2009, at 11:17 AM, Bilgin Ibryam wrote:
>
>> jacopoc@apache.org wrote:
>>> Author: jacopoc
>>> Date: Sun Nov 22 10:23:09 2009
>>> New Revision: 883056
>>>
>>> URL: http://svn.apache.org/viewvc?rev=883056&view=rev
>>> Log:
>>> New improved version of an enhancement to the service framework after I reverted my first one because it was causing some issues 
>>> with service validations.
>>> Added two new IN parameter, internally (and automatically) set for service definitions:
>>> login.username
>>> login.password
>>> They are already used by the authorization service ("userLogin") to authorize the user to the service call and to retrieve the 
>>> userLogin object (if the user is authorized).
>>> They can be passed to the service in the input context in place of the userLogin object: this is useful when the service is 
>>> invoked from a remote system (thru SOAP etc...).
>>>
>>
>> Jacopo,
>>
>> these two internal parameters are really helpful to authorize the user when calling a service thru soap. Till that point I was 
>> using http header REMOTE_USER to log in the user with some tricks in SoapEventHandler.
>> So now I'm thinking to do login.username and login.password parameters present on the wsdl generated for ofbiz services. This 
>> would make it easier to enter these values on the soap call.
>> Currently none of the internal service parameters are included in the generated wsdl, but having login.username and 
>> login.password there make sense.
>>
>> WDYT?
>
> It seems a good idea to me, but I'd like to hear others' opinion.

Did not look into details but this seems to be a goo idea, yes!

Jacques

> Thank you, Bilgin.
>
> Jacopo
>
> 



Re: svn commit: r883056 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelServiceReader.java service/src/org/ofbiz/service/ServiceDispatcher.java widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
On Dec 3, 2009, at 11:17 AM, Bilgin Ibryam wrote:

> jacopoc@apache.org wrote:
>> Author: jacopoc
>> Date: Sun Nov 22 10:23:09 2009
>> New Revision: 883056
>> 
>> URL: http://svn.apache.org/viewvc?rev=883056&view=rev
>> Log:
>> New improved version of an enhancement to the service framework after I reverted my first one because it was causing some issues with service validations.
>> Added two new IN parameter, internally (and automatically) set for service definitions:
>> login.username
>> login.password
>> They are already used by the authorization service ("userLogin") to authorize the user to the service call and to retrieve the userLogin object (if the user is authorized).
>> They can be passed to the service in the input context in place of the userLogin object: this is useful when the service is invoked from a remote system (thru SOAP etc...).
>>  
> 
> Jacopo,
> 
> these two internal parameters are really helpful to authorize the user when calling a service thru soap. Till that point I was using http header REMOTE_USER to log in the user with some tricks in SoapEventHandler.
> So now I'm thinking to do login.username and login.password parameters present on the wsdl generated for ofbiz services. This would make it easier to enter these values on the soap call.
> Currently none of the internal service parameters are included in the generated wsdl, but having login.username and login.password there make sense.
> 
> WDYT?

It seems a good idea to me, but I'd like to hear others' opinion.

Thank you, Bilgin.

Jacopo


Re: svn commit: r883056 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelServiceReader.java service/src/org/ofbiz/service/ServiceDispatcher.java widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Bilgin Ibryam <bi...@gmail.com>.
jacopoc@apache.org wrote:
> Author: jacopoc
> Date: Sun Nov 22 10:23:09 2009
> New Revision: 883056
>
> URL: http://svn.apache.org/viewvc?rev=883056&view=rev
> Log:
> New improved version of an enhancement to the service framework after I reverted my first one because it was causing some issues with service validations.
> Added two new IN parameter, internally (and automatically) set for service definitions:
> login.username
> login.password
> They are already used by the authorization service ("userLogin") to authorize the user to the service call and to retrieve the userLogin object (if the user is authorized).
> They can be passed to the service in the input context in place of the userLogin object: this is useful when the service is invoked from a remote system (thru SOAP etc...).
>   

Jacopo,

these two internal parameters are really helpful to authorize the user 
when calling a service thru soap. Till that point I was using http 
header REMOTE_USER to log in the user with some tricks in SoapEventHandler.
So now I'm thinking to do login.username and login.password parameters 
present on the wsdl generated for ofbiz services. This would make it 
easier to enter these values on the soap call.
Currently none of the internal service parameters are included in the 
generated wsdl, but having login.username and login.password there make 
sense.

WDYT?