Search in sources :

Example 6 with AccessType

use of org.apache.cloudstack.acl.SecurityChecker.AccessType in project cloudstack by apache.

the class IAMApiServiceImpl method addIAMPermissionToIAMPolicy.

@DB
@Override
@ActionEvent(eventType = EventTypes.EVENT_IAM_POLICY_GRANT, eventDescription = "Granting acl permission to IAM Policy")
public IAMPolicy addIAMPermissionToIAMPolicy(long iamPolicyId, String entityType, PermissionScope scope, Long scopeId, String action, Permission perm, Boolean recursive, Boolean readOnly) {
    Class<?> cmdClass = _apiServer.getCmdClass(action);
    AccessType accessType = null;
    if (BaseListCmd.class.isAssignableFrom(cmdClass)) {
        if (readOnly) {
            accessType = AccessType.ListEntry;
        } else {
            accessType = AccessType.UseEntry;
        }
    } else {
        accessType = AccessType.OperateEntry;
    }
    String accessTypeStr = (accessType != null) ? accessType.toString() : null;
    return _iamSrv.addIAMPermissionToIAMPolicy(iamPolicyId, entityType, scope.toString(), scopeId, action, accessTypeStr, perm, recursive);
}
Also used : AccessType(org.apache.cloudstack.acl.SecurityChecker.AccessType) ActionEvent(com.cloud.event.ActionEvent) DB(com.cloud.utils.db.DB)

Aggregations

AccessType (org.apache.cloudstack.acl.SecurityChecker.AccessType)6 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 PermissionDeniedException (com.cloud.exception.PermissionDeniedException)2 Account (com.cloud.user.Account)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 List (java.util.List)2 Map (java.util.Map)2 Domain (com.cloud.domain.Domain)1 ActionEvent (com.cloud.event.ActionEvent)1 AccountVO (com.cloud.user.AccountVO)1 SSHKeyPair (com.cloud.user.SSHKeyPair)1 Pair (com.cloud.utils.Pair)1 DB (com.cloud.utils.db.DB)1 Field (java.lang.reflect.Field)1 ParseException (java.text.ParseException)1 ConfigurationException (javax.naming.ConfigurationException)1 ControlledEntity (org.apache.cloudstack.acl.ControlledEntity)1 InfrastructureEntity (org.apache.cloudstack.acl.InfrastructureEntity)1