Bug fix identified by marvin test.

This commit is contained in:
Min Chen 2014-03-03 17:24:46 -08:00
parent a837ac8873
commit 61b47850f2
6 changed files with 10 additions and 11 deletions

View File

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

View File

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

View File

@ -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);
}

View File

@ -63,7 +63,7 @@ public class IAMAccountPolicyMapVO {
return accountId;
}
public long getIAMPolicyId() {
public long getIamPolicyId() {
return iamPolicyId;
}

View File

@ -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>();

View File

@ -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();