From 056d21e14bb2e69aa231e8941a43b0b628b3443c Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 4 Mar 2014 11:16:45 -0800 Subject: [PATCH] Fix bugs found from marvin test. --- .../api/command/iam/RemoveIAMPolicyFromAccountCmd.java | 3 ++- .../src/org/apache/cloudstack/iam/server/IAMServiceImpl.java | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/RemoveIAMPolicyFromAccountCmd.java b/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/RemoveIAMPolicyFromAccountCmd.java index 9158027a04c..48c2a7386b9 100644 --- a/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/RemoveIAMPolicyFromAccountCmd.java +++ b/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/RemoveIAMPolicyFromAccountCmd.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.iam.IAMPolicyResponse; import org.apache.cloudstack.context.CallContext; @@ -59,7 +60,7 @@ public class RemoveIAMPolicyFromAccountCmd extends BaseAsyncCmd { private Long id; @ACL - @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = IAMPolicyResponse.class, description = "comma separated list of iam policy id that are going to be applied to the iam group.") + @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AccountResponse.class, description = "comma separated list of iam policy id that are going to be applied to the iam group.") private List accountIdList; diff --git a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java index 4f03142e5ca..097d84f958c 100644 --- a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java +++ b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java @@ -607,9 +607,8 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager { // add entries in acl_group_policy_map table for (Long acctId : acctIds) { IAMAccountPolicyMapVO acctMap = _aclAccountPolicyMapDao.findByAccountAndPolicy(acctId, policyId); - if (acctMap == null) { - // not there already - acctMap = new IAMAccountPolicyMapVO(acctId, policyId); + if (acctMap != null) { + // exists _aclAccountPolicyMapDao.remove(acctMap.getId()); } }