details:   https://code.openbravo.com/erp/devel/pi/rev/1912a8ab2d98
changeset: 13817:1912a8ab2d98
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Sep 22 16:32:46 2011 +0200
summary:   Fixes issue 18593: REST Webservice PUT method does not find objects
Also search the other orgs an user has access to

diffstat:

 src/org/openbravo/dal/xml/EntityResolver.java |  30 +++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diffs (54 lines):

diff -r b5d3e86fb097 -r 1912a8ab2d98 
src/org/openbravo/dal/xml/EntityResolver.java
--- a/src/org/openbravo/dal/xml/EntityResolver.java     Thu Sep 22 16:13:14 
2011 +0200
+++ b/src/org/openbravo/dal/xml/EntityResolver.java     Thu Sep 22 16:32:46 
2011 +0200
@@ -247,6 +247,16 @@
       result = searchClient(id, entity);
     } else if (al == AccessLevel.ORGANIZATION) {
       result = searchClientOrganization(id, entity);
+
+      if (result == null) {
+        // still null, try all the orgs the user has access to
+        for (String orgId : 
OBContext.getOBContext().getReadableOrganizations()) {
+          result = search(id, entity, orgId);
+          if (result != null) {
+            break;
+          }
+        }
+      }
     } else if (al == AccessLevel.CLIENT_ORGANIZATION) {
       // search 2 levels
       result = searchClientOrganization(id, entity);
@@ -258,6 +268,16 @@
               .compareTo(AttributeSet.ENTITY_NAME) == 0)) {
         result = searchSystem(id, entity);
       }
+
+      if (result == null) {
+        // still null, try all the orgs the user has access to
+        for (String orgId : 
OBContext.getOBContext().getReadableOrganizations()) {
+          result = search(id, entity, orgId);
+          if (result != null) {
+            break;
+          }
+        }
+      }
     } else if (al == AccessLevel.ALL) {
       // search all three levels from the bottom
       result = searchClientOrganization(id, entity);
@@ -267,6 +287,16 @@
       if (result == null) {
         result = searchSystem(id, entity);
       }
+
+      if (result == null) {
+        // still null, try all the orgs the user has access to
+        for (String orgId : 
OBContext.getOBContext().getReadableOrganizations()) {
+          result = search(id, entity, orgId);
+          if (result != null) {
+            break;
+          }
+        }
+      }
     }
     return result;
   }

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to