From b725035b229f2182bfabbb83c381f5994bb0848d Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 14 Jan 2014 18:20:32 -0800 Subject: [PATCH] Fix NPE about accessType in RoleBasedApiAccessChecker.start. --- .../apache/cloudstack/acl/RoleBasedAPIAccessChecker.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/iam/plugin/src/org/apache/cloudstack/acl/RoleBasedAPIAccessChecker.java b/services/iam/plugin/src/org/apache/cloudstack/acl/RoleBasedAPIAccessChecker.java index d193c943450..dd49eb1fb5a 100644 --- a/services/iam/plugin/src/org/apache/cloudstack/acl/RoleBasedAPIAccessChecker.java +++ b/services/iam/plugin/src/org/apache/cloudstack/acl/RoleBasedAPIAccessChecker.java @@ -28,10 +28,6 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; -import org.apache.cloudstack.acl.APIChecker; -import org.apache.cloudstack.acl.AclEntityType; -import org.apache.cloudstack.acl.PermissionScope; -import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.BaseCmd; @@ -207,11 +203,11 @@ public class RoleBasedAPIAccessChecker extends AdapterBase implements APIChecker if (entityTypes == null || entityTypes.length == 0) { _iamSrv.addAclPermissionToAclPolicy(new Long(role.ordinal()) + 1, null, permissionScope.toString(), new Long(-1), - apiName, accessType.toString(), Permission.Allow); + apiName, (accessType == null) ? null : accessType.toString(), Permission.Allow); } else { for (AclEntityType entityType : entityTypes) { _iamSrv.addAclPermissionToAclPolicy(new Long(role.ordinal()) + 1, entityType.toString(), permissionScope.toString(), new Long(-1), - apiName, accessType.toString(), Permission.Allow); + apiName, (accessType == null) ? null : accessType.toString(), Permission.Allow); } }