Bug fix identified by marvin test.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/61b47850 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/61b47850 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/61b47850 Branch: refs/heads/master Commit: 61b47850f2839c9eb1381584c578dd48ac85d115 Parents: a837ac8 Author: Min Chen <[email protected]> Authored: Mon Mar 3 17:24:46 2014 -0800 Committer: Min Chen <[email protected]> Committed: Mon Mar 3 17:26:16 2014 -0800 ---------------------------------------------------------------------- .../api/command/iam/AddIAMPermissionToIAMPolicyCmd.java | 2 +- .../api/command/iam/RemoveIAMPolicyFromAccountCmd.java | 5 ++--- .../src/org/apache/cloudstack/iam/IAMApiServiceImpl.java | 6 +++--- .../apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java | 2 +- .../src/org/apache/cloudstack/iam/server/IAMServiceImpl.java | 2 +- .../cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/AddIAMPermissionToIAMPolicyCmd.java ---------------------------------------------------------------------- diff --git a/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/AddIAMPermissionToIAMPolicyCmd.java b/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/AddIAMPermissionToIAMPolicyCmd.java index a66390a..e991537 100644 --- a/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/AddIAMPermissionToIAMPolicyCmd.java +++ b/services/iam/plugin/src/org/apache/cloudstack/api/command/iam/AddIAMPermissionToIAMPolicyCmd.java @@ -72,7 +72,7 @@ public class AddIAMPermissionToIAMPolicyCmd extends BaseAsyncCmd { required = false, description = "iam permission scope") private String scope; - @Parameter(name = ApiConstants.IAM_SCOPE_ID, type = CommandType.UUID, required = false, description = "The UUID of the permission scope id") + @Parameter(name = ApiConstants.IAM_SCOPE_ID, type = CommandType.STRING, required = false, description = "The UUID of the permission scope id") private String scopeId; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/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 b665e84..9158027 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 @@ -22,7 +22,6 @@ import javax.inject.Inject; import org.apache.log4j.Logger; -import org.apache.cloudstack.iam.IAMApiService; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; @@ -31,9 +30,9 @@ import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; -import org.apache.cloudstack.api.response.iam.IAMGroupResponse; import org.apache.cloudstack.api.response.iam.IAMPolicyResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.iam.IAMApiService; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientCapacityException; @@ -55,7 +54,7 @@ public class RemoveIAMPolicyFromAccountCmd extends BaseAsyncCmd { @ACL - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IAMGroupResponse.class, + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IAMPolicyResponse.class, required = true, description = "The ID of the iam group") private Long id; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java ---------------------------------------------------------------------- diff --git a/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java b/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java index 42c1adc..97519f2 100644 --- a/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java +++ b/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java @@ -112,7 +112,7 @@ import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.DB; import com.cloud.utils.db.EntityManager; import com.cloud.vm.InstanceGroupVO; -import com.cloud.vm.UserVmVO; +import com.cloud.vm.VMInstanceVO; import com.cloud.vm.dao.NicIpAliasVO; import com.cloud.vm.dao.NicSecondaryIpVO; import com.cloud.vm.snapshot.VMSnapshotVO; @@ -146,7 +146,7 @@ public class IAMApiServiceImpl extends ManagerBase implements IAMApiService, Man private static final Map<IAMEntityType, Class<?>> s_typeMap = new HashMap<IAMEntityType, Class<?>>(); static { - s_typeMap.put(IAMEntityType.VirtualMachine, UserVmVO.class); + s_typeMap.put(IAMEntityType.VirtualMachine, VMInstanceVO.class); s_typeMap.put(IAMEntityType.Volume, VolumeVO.class); s_typeMap.put(IAMEntityType.ResourceTag, ResourceTagVO.class); s_typeMap.put(IAMEntityType.Account, AccountVO.class); @@ -768,7 +768,7 @@ public class IAMApiServiceImpl extends ManagerBase implements IAMApiService, Man entity = _accountDao.findByUuid(scopeId); break; case RESOURCE: - Class<?> clazz = s_typeMap.get(entityType); + Class<?> clazz = s_typeMap.get(IAMEntityType.valueOf(entityType)); entity = (InternalIdentity)_entityMgr.findByUuid(clazz, scopeId); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/services/iam/server/src/org/apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java ---------------------------------------------------------------------- diff --git a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java index a537655..18f085a 100644 --- a/services/iam/server/src/org/apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java +++ b/services/iam/server/src/org/apache/cloudstack/iam/server/IAMAccountPolicyMapVO.java @@ -63,7 +63,7 @@ public class IAMAccountPolicyMapVO { return accountId; } - public long getIAMPolicyId() { + public long getIamPolicyId() { return iamPolicyId; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/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 11af27e..4f03142 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 @@ -395,7 +395,7 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager { // add policies directly attached to the account List<IAMAccountPolicyMapVO> acctPolicies = _aclAccountPolicyMapDao.listByAccountId(accountId); for (IAMAccountPolicyMapVO p : acctPolicies) { - policyIds.add(p.getIAMPolicyId()); + policyIds.add(p.getIamPolicyId()); } if (policyIds.size() == 0) { return new ArrayList<IAMPolicy>(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61b47850/services/iam/server/src/org/apache/cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java ---------------------------------------------------------------------- diff --git a/services/iam/server/src/org/apache/cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java b/services/iam/server/src/org/apache/cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java index a112a3e..3ecca3b 100644 --- a/services/iam/server/src/org/apache/cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java +++ b/services/iam/server/src/org/apache/cloudstack/iam/server/dao/IAMAccountPolicyMapDaoImpl.java @@ -26,11 +26,11 @@ public class IAMAccountPolicyMapDaoImpl extends GenericDaoBase<IAMAccountPolicyM ListByAccountId.done(); ListByPolicyId = createSearchBuilder(); - ListByPolicyId.and("policyId", ListByPolicyId.entity().getIAMPolicyId(), SearchCriteria.Op.EQ); + ListByPolicyId.and("policyId", ListByPolicyId.entity().getIamPolicyId(), SearchCriteria.Op.EQ); ListByPolicyId.done(); findByPolicyAccountId = createSearchBuilder(); - findByPolicyAccountId.and("policyId", findByPolicyAccountId.entity().getIAMPolicyId(), SearchCriteria.Op.EQ); + findByPolicyAccountId.and("policyId", findByPolicyAccountId.entity().getIamPolicyId(), SearchCriteria.Op.EQ); findByPolicyAccountId.and("accountId", findByPolicyAccountId.entity().getAccountId(), SearchCriteria.Op.EQ); findByPolicyAccountId.done();
