Author: jaz
Date: Thu Apr 30 05:49:25 2009
New Revision: 770076

URL: http://svn.apache.org/viewvc?rev=770076&view=rev
Log:
changed name of context in groovy DA handler; conflicted with the internal name 
'context'; added logging and minor fixes

Modified:
    
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java
    
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java
    
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/GroovyDaHandler.java

Modified: 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java?rev=770076&r1=770075&r2=770076&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java
 (original)
+++ 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbtractAuthorization.java
 Thu Apr 30 05:49:25 2009
@@ -107,7 +107,7 @@
                int index = 1;
                
                if (permSplit != null && permSplit.length > 1) {
-                   if (Debug.infoOn()) Debug.logInfo("Security 2.0 schema 
found -- walking tree : " + expandedPermission, module);
+                   if (Debug.verboseOn()) Debug.logVerbose("Security 2.0 
schema found -- walking tree : " + expandedPermission, module);
                // start walking
                for (String perm : permSplit) {
                    if (permSplit.length >= index) {
@@ -119,7 +119,9 @@
                                // first check auto-granted permissions
                                List<String> grantedPerms = autoGrant.get();
                                if (grantedPerms != null && grantedPerms.size() 
> 0) {
+                                   Debug.logVerbose("Auto-Grant permissions 
found; looking for a match", module);
                                        for (String granted : grantedPerms) {
+                                           if (Debug.verboseOn()) 
Debug.logVerbose("Testing - " + granted + " - with - " + joined.toString(), 
module);
                                                if 
(joined.toString().equals(granted)) {
                                                    // permission granted
                                                    
handleAutoGrantPermissions(userId, expandedPermission, context);
@@ -167,9 +169,10 @@
             
             // expand the auto-grant permissions
             for (String toGrant : granted) {
-                if (UtilValidate.isNotEmpty(toGrant)) {
-                    if (Debug.verboseOn()) Debug.logVerbose("Adding auto-grant 
permission -- " + toGrant, module);
-                    
alreadyGranted.add(FlexibleStringExpander.expandString(toGrant, context)); 
+                if (UtilValidate.isNotEmpty(toGrant)) {                    
+                    String grantExpanded = 
FlexibleStringExpander.expandString(toGrant, context);
+                    if (Debug.verboseOn()) Debug.logVerbose("Adding auto-grant 
permission -- " + grantExpanded, module);
+                    alreadyGranted.add(grantExpanded); 
                 }
             }
             autoGrant.set(granted);            

Modified: 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java?rev=770076&r1=770075&r2=770076&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java
 (original)
+++ 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java
 Thu Apr 30 05:49:25 2009
@@ -67,6 +67,7 @@
            String checkString = permission;
            
            while (checking) {
+               if (Debug.verboseOn()) Debug.logVerbose("Looking for auto-grant 
permissions for : " + checkString, module);
                List<String> autoGrant = getPermissionAutoGrant(checkString);
                if (autoGrant != null && autoGrant.size() > 0) {
                    return autoGrant;
@@ -83,7 +84,7 @@
        @Override
        public boolean hasDynamicPermission(String userId, String permission, 
Map<String, ? extends Object> context) {
            if (Debug.verboseOn()) Debug.logVerbose("Running 
hasDynamicPermission()", module);      
-               String permissionId = permission.substring(0, 
permission.lastIndexOf(":"));
+               String permissionId = permission;
                boolean checking = true;
                
                // find the dynamic access implementation

Modified: 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/GroovyDaHandler.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/GroovyDaHandler.java?rev=770076&r1=770075&r2=770076&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/GroovyDaHandler.java
 (original)
+++ 
ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/GroovyDaHandler.java
 Thu Apr 30 05:49:25 2009
@@ -42,7 +42,7 @@
         bindings.put("accessString", accessString);
         bindings.put("permission", permission);
         bindings.put("userId", userId);
-        bindings.put("context", context);
+        bindings.put("permissionContext", context);
         
         Debug.log("Attempting to call groovy script : " + accessString, 
module);
         Object result = null;


Reply via email to