details: https://code.openbravo.com/erp/devel/pi/rev/a2b35719f45a
changeset: 23051:a2b35719f45a
user: Guillermo Gil <guillermo.gil <at> openbravo.com>
date: Fri May 16 12:35:09 2014 +0200
summary: Fixed issue 26566:Error returned when calling to websevices
error is returned when a call to web service is done and the role used don't
have permission to Role and User window
Added isWebServiceEnabled to OBContext
diffstat:
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java
| 4 ++--
src/org/openbravo/dal/core/OBContext.java
| 9 ++++++++-
src/org/openbravo/service/web/BaseWebServiceServlet.java
| 4 ++--
3 files changed, 12 insertions(+), 5 deletions(-)
diffs (76 lines):
diff -r dbc986ded642 -r a2b35719f45a
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java
Fri May 16 10:44:04 2014 +0200
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java
Fri May 16 12:35:09 2014 +0200
@@ -84,12 +84,12 @@
+ OBContext.getOBContext().getRole()
+ " is trying to access to non granted web service " +
request.getRequestURL());
throw new OBSecurityException("Web Services are not granted to
Portal roles");
- } else if (!OBContext.getOBContext().getRole().isWebServiceEnabled()) {
+ } else if (!OBContext.getOBContext().isWebServiceEnabled()) {
log.error("User " + OBContext.getOBContext().getUser() + " with role
"
+ OBContext.getOBContext().getRole()
+ " is trying to access to non granted web service " +
request.getRequestURL());
throw new OBSecurityException("Web Services are not granted to "
- + OBContext.getOBContext().getRole().getName() + " role");
+ + OBContext.getOBContext().getRole() + " role");
}
}
callServiceInSuper(request, response);
diff -r dbc986ded642 -r a2b35719f45a src/org/openbravo/dal/core/OBContext.java
--- a/src/org/openbravo/dal/core/OBContext.java Fri May 16 10:44:04 2014 +0200
+++ b/src/org/openbravo/dal/core/OBContext.java Fri May 16 12:35:09 2014 +0200
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2008-2013 Openbravo SLU
+ * All portions are Copyright (C) 2008-2014 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -484,6 +484,8 @@
private boolean isPortalRole = false;
+ private boolean isWebServiceEnabled = false;
+
private Set<String> additionalWritableOrganizations = new HashSet<String>();
// support storing the context in a persistent tomcat session
@@ -952,6 +954,7 @@
public void setRole(Role role) {
isAdministrator = ((String) DalUtil.getId(role)).equals("0");
isPortalRole = role.isForPortalUsers();
+ isWebServiceEnabled = role.isWebServiceEnabled();
setUserLevel(role.getUserLevel());
entityAccessChecker = null;
writableOrganizations = null;
@@ -1134,6 +1137,10 @@
return isPortalRole;
}
+ public boolean isWebServiceEnabled() {
+ return isWebServiceEnabled;
+ }
+
public void setRTL(boolean isRTL) {
this.isRTL = isRTL;
}
diff -r dbc986ded642 -r a2b35719f45a
src/org/openbravo/service/web/BaseWebServiceServlet.java
--- a/src/org/openbravo/service/web/BaseWebServiceServlet.java Fri May 16
10:44:04 2014 +0200
+++ b/src/org/openbravo/service/web/BaseWebServiceServlet.java Fri May 16
12:35:09 2014 +0200
@@ -100,12 +100,12 @@
+ OBContext.getOBContext().getRole()
+ " is trying to access to non granted web service " +
request.getRequestURL());
throw new OBSecurityException("Web Services are not granted to
Portal roles");
- } else if (!OBContext.getOBContext().getRole().isWebServiceEnabled()) {
+ } else if (!OBContext.getOBContext().isWebServiceEnabled()) {
log.error("User " + OBContext.getOBContext().getUser() + " with role
"
+ OBContext.getOBContext().getRole()
+ " is trying to access to non granted web service " +
request.getRequestURL());
throw new OBSecurityException("Web Services are not granted to "
- + OBContext.getOBContext().getRole().getName() + " role");
+ + OBContext.getOBContext().getRole() + " role");
}
}
super.service(request, response);
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits