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

This commit is contained in:
Min Chen 2014-05-09 11:10:26 -07:00
parent f2d9d71844
commit 5f8641e908
1 changed files with 4 additions and 1 deletions

View File

@ -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 {