mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	Bug fix identified by marvin test.
This commit is contained in:
		
							parent
							
								
									a837ac8873
								
							
						
					
					
						commit
						61b47850f2
					
				@ -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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@ public class IAMAccountPolicyMapVO {
 | 
			
		||||
        return accountId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getIAMPolicyId() {
 | 
			
		||||
    public long getIamPolicyId() {
 | 
			
		||||
        return iamPolicyId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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>();
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user