use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class CustomImageCatalogV4Controller method updateCustomImage.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.EDIT_IMAGE_CATALOG)
public CustomImageCatalogV4UpdateImageResponse updateCustomImage(@ResourceName String name, String imageId, @Valid CustomImageCatalogV4UpdateImageRequest request, @AccountId String accountId) {
String creator = ThreadBasedUserCrnProvider.getUserCrn();
CustomImage customImage = customImageCatalogV4UpdateImageRequestToCustomImageConverter.convert(request);
customImage.setName(imageId);
CustomImage savedCustomImage = customImageCatalogService.updateCustomImage(restRequestThreadLocalService.getRequestedWorkspaceId(), creator, name, customImage);
return customImageToCustomImageCatalogV4UpdateImageResponseConverter.convert(savedCustomImage);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class EnvironmentController method getByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public DetailedEnvironmentResponse getByName(@ResourceName String environmentName) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
EnvironmentDto environmentDto = environmentService.getByNameAndAccountId(environmentName, accountId);
return environmentResponseConverter.dtoToDetailedResponse(environmentDto);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class EnvironmentController method editByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.EDIT_ENVIRONMENT)
public DetailedEnvironmentResponse editByName(@ResourceName String environmentName, @NotNull EnvironmentEditRequest request) {
EnvironmentEditDto editDto = environmentApiConverter.initEditDto(request);
EnvironmentDto result = environmentModificationService.editByName(environmentName, editDto);
return environmentResponseConverter.dtoToDetailedResponse(result);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class EnvironmentController method changeCredentialByEnvironmentName.
@Override
@CheckPermissionByRequestProperty(path = "credentialName", type = NAME, action = DESCRIBE_CREDENTIAL)
@CheckPermissionByResourceName(action = AuthorizationResourceAction.CHANGE_CREDENTIAL)
public DetailedEnvironmentResponse changeCredentialByEnvironmentName(@ResourceName String environmentName, @RequestObject @Valid EnvironmentChangeCredentialRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
EnvironmentChangeCredentialDto dto = environmentApiConverter.convertEnvironmentChangeCredentialDto(request);
EnvironmentDto result = environmentModificationService.changeCredentialByEnvironmentName(accountId, environmentName, dto);
return environmentResponseConverter.dtoToDetailedResponse(result);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceName in project cloudbreak by hortonworks.
the class EnvironmentController method updateAzureResourceEncryptionParametersByEnvironmentName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.UPDATE_AZURE_ENCRYPTION_RESOURCES)
public DetailedEnvironmentResponse updateAzureResourceEncryptionParametersByEnvironmentName(@ResourceName String environmentName, @RequestObject @Valid UpdateAzureResourceEncryptionParametersRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
UpdateAzureResourceEncryptionDto dto = environmentApiConverter.convertUpdateAzureResourceEncryptionDto(request);
EnvironmentDto result = environmentModificationService.updateAzureResourceEncryptionParametersByEnvironmentName(accountId, environmentName, dto);
return environmentResponseConverter.dtoToDetailedResponse(result);
}
Aggregations