fixed bug 27057: can't select value in drop down if role has no access to field entity
authorAsier Lostalé <asier.lostale@openbravo.com>
Mon, 14 Jul 2014 09:17:23 +0200
changeset 24167 657594721802
parent 24166 0d4bd4e76b8e
child 24168 d995197101cb
fixed bug 27057: can't select value in drop down if role has no access to field entity

Entity access check is done in admin mode, other case it failed if current role had no
access to field/column entities
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ComboTableDatasourceService.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ComboTableDatasourceService.java	Thu Jul 10 17:38:04 2014 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ComboTableDatasourceService.java	Mon Jul 14 09:17:23 2014 +0200
@@ -72,18 +72,16 @@
     String filterString = null;
 
     int startRow = -1, endRow = -1, num = 0;
-    ;
+
+    OBContext.setAdminMode(true);
     try {
+      // check access to current entity
       field = OBDal.getInstance().get(Field.class, fieldId);
       column = field.getColumn();
       targetEntity = ModelProvider.getInstance().getEntityByTableId(
           (String) DalUtil.getId(column.getTable()));
       OBContext.getOBContext().getEntityAccessChecker().checkReadable(targetEntity);
-    } catch (Exception e1) {
-      throw new OBException(e1);
-    }
-    OBContext.setAdminMode(true);
-    try {
+
       if (!StringUtils.isEmpty(parameters.get("criteria"))) {
         String criteria = parameters.get("criteria");
         for (String criterion : criteria.split(JsonConstants.IN_PARAMETER_SEPARATOR)) {