Repository: cloudstack
Updated Branches:
  refs/heads/master f2d9d7184 -> daadc4512


CLOUDSTACK-6600: fix a bug in IAM cache in constructing cache key.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5f8641e9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5f8641e9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5f8641e9

Branch: refs/heads/master
Commit: 5f8641e908b16f0a3e7572a6e17e7bb6356c6112
Parents: f2d9d71
Author: Min Chen <[email protected]>
Authored: Fri May 9 11:10:26 2014 -0700
Committer: Min Chen <[email protected]>
Committed: Fri May 9 18:47:37 2014 -0700

----------------------------------------------------------------------
 .../org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f8641e9/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java
----------------------------------------------------------------------
diff --git 
a/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java
 
b/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java
index b384d7c..e8a41ef 100644
--- 
a/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java
+++ 
b/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java
@@ -66,6 +66,9 @@ public class RoleBasedEntityAccessChecker extends 
DomainChecker implements Secur
         String entityType = null;
         if (entity != null && entity.getEntityType() != null) {
             entityType = entity.getEntityType().getSimpleName();
+            if (entity instanceof InternalIdentity) {
+                entityType += ((InternalIdentity)entity).getId();
+            }
         }
         key.append(entityType != null ? entityType : "null");
         key.append("-");
@@ -91,7 +94,7 @@ public class RoleBasedEntityAccessChecker extends 
DomainChecker implements Secur
         String accessKey = buildAccessCacheKey(caller, entity, accessType, 
action);
         CheckAccessResult allowDeny = 
(CheckAccessResult)_iamSrv.getFromIAMCache(accessKey);
         if (allowDeny != null) {
-            s_logger.debug("IAM access check for " + accessKey + " from 
cache");
+            s_logger.debug("IAM access check for " + accessKey + " from cache: 
" + allowDeny.isAllow());
             if (allowDeny.isAllow()) {
                 return true;
             } else {

Reply via email to