Fix bugs found from marvin test. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/056d21e1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/056d21e1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/056d21e1
Branch: refs/heads/master Commit: 056d21e14bb2e69aa231e8941a43b0b628b3443c Parents: 91882e2 Author: Min Chen <[email protected]> Authored: Tue Mar 4 11:16:45 2014 -0800 Committer: Min Chen <[email protected]> Committed: Tue Mar 4 11:16:45 2014 -0800 ---------------------------------------------------------------------- .../api/command/iam/RemoveIAMPolicyFromAccountCmd.java | 3 ++- .../src/org/apache/cloudstack/iam/server/IAMServiceImpl.java | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/056d21e1/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/RemoveIAMPolicyFromAccountCmd.java ---------------------------------------------------------------------- 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 9158027..48c2a73 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<Long> accountIdList; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/056d21e1/services/iam/server/src/org/apache/cloudstack/iam/server/IAMServiceImpl.java ---------------------------------------------------------------------- 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 4f03142..097d84f 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()); } }
