use of com.sequenceiq.authorization.resource.AuthorizationResourceAction in project cloudbreak by hortonworks.
the class ResourceNameAuthorizationFactory method doGetAuthorization.
@Override
public Optional<AuthorizationRule> doGetAuthorization(CheckPermissionByResourceName methodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature) {
AuthorizationResourceAction action = methodAnnotation.action();
String resourceName = commonPermissionCheckingUtils.getParameter(proceedingJoinPoint, methodSignature, ResourceName.class, String.class);
LOGGER.debug("Getting authorization rule to authorize user [{}] for action [{}] over resource [{}]", userCrn, action, resourceName);
return calcAuthorization(resourceName, action);
}
use of com.sequenceiq.authorization.resource.AuthorizationResourceAction in project cloudbreak by hortonworks.
the class AccountAuthorizationService method authorize.
public void authorize(CheckPermissionByAccount methodAnnotation, String userCrn) {
AuthorizationResourceAction action = methodAnnotation.action();
LOGGER.debug("Authorize {} action for user {} on account level.", action, userCrn);
commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn);
}
use of com.sequenceiq.authorization.resource.AuthorizationResourceAction in project cloudbreak by hortonworks.
the class ResourceCrnAthorizationFactory method doGetAuthorization.
@Override
public Optional<AuthorizationRule> doGetAuthorization(CheckPermissionByResourceCrn methodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature) {
String resourceCrn = commonPermissionCheckingUtils.getParameter(proceedingJoinPoint, methodSignature, ResourceCrn.class, String.class);
crnAccountValidator.validateSameAccount(userCrn, resourceCrn);
AuthorizationResourceAction action = methodAnnotation.action();
LOGGER.debug("Getting authorization rule to authorize user [{}] for action [{}] over resource [{}]", userCrn, action, resourceCrn);
return calcAuthorization(resourceCrn, action);
}
use of com.sequenceiq.authorization.resource.AuthorizationResourceAction in project cloudbreak by hortonworks.
the class ResourceNameListAuthorizationFactory method doGetAuthorization.
@Override
public Optional<AuthorizationRule> doGetAuthorization(CheckPermissionByResourceNameList methodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature) {
AuthorizationResourceAction action = methodAnnotation.action();
Collection<String> resourceNames = commonPermissionCheckingUtils.getParameter(proceedingJoinPoint, methodSignature, ResourceNameList.class, Collection.class);
LOGGER.debug("Getting authorization rule to authorize user [{}] for action [{}] over resources [{}]", userCrn, action, Joiner.on(",").join(resourceNames));
return calcAuthorization(resourceNames, action);
}
Aggregations