use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class ClusterTemplateV4Controller method deleteByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CLUSTER_DEFINITION)
public ClusterTemplateV4Response deleteByCrn(Long workspaceId, @TenantAwareParam @ResourceCrn String crn) {
boolean internalTenant = isInternalTenant();
ClusterTemplate clusterTemplate = clusterTemplateService.deleteByCrn(crn, threadLocalService.getRequestedWorkspaceId(), internalTenant);
return clusterTemplateToClusterTemplateV4ResponseConverter.convert(clusterTemplate);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class UserV1Controller method getUserSyncState.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public EnvironmentUserSyncState getUserSyncState(@ResourceCrn @TenantAwareParam @NotEmpty String environmentCrn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Crn envCrn = Crn.safeFromString(environmentCrn);
return environmentUserSyncStateCalculator.calculateEnvironmentUserSyncState(accountId, envCrn);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentController method getByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public DetailedEnvironmentResponse getByCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn @TenantAwareParam String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
EnvironmentDto environmentDto = environmentService.getByCrnAndAccountId(crn, accountId);
return environmentResponseConverter.dtoToDetailedResponse(environmentDto);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentController method deleteByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_ENVIRONMENT)
public SimpleEnvironmentResponse deleteByCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn @TenantAwareParam String crn, boolean cascading, boolean forced) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String actualUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
EnvironmentViewDto environmentDto = environmentDeletionService.deleteByCrnAndAccountId(crn, accountId, actualUserCrn, cascading, forced);
return environmentResponseConverter.dtoToSimpleResponse(environmentDto);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentController method updateAzureResourceEncryptionParametersByEnvironmentCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.UPDATE_AZURE_ENCRYPTION_RESOURCES)
public DetailedEnvironmentResponse updateAzureResourceEncryptionParametersByEnvironmentCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn String crn, @RequestObject @Valid UpdateAzureResourceEncryptionParametersRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
EnvironmentDto result = environmentModificationService.updateAzureResourceEncryptionParametersByEnvironmentCrn(accountId, crn, environmentApiConverter.convertUpdateAzureResourceEncryptionDto(request));
return environmentResponseConverter.dtoToDetailedResponse(result);
}
Aggregations