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) {