Search in sources :

Example 6 with CheckPermissionByResourceName

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);
}
Also used : CustomImage(com.sequenceiq.cloudbreak.domain.CustomImage) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 7 with CheckPermissionByResourceName

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);
}
Also used : EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 8 with CheckPermissionByResourceName

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);
}
Also used : EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) EnvironmentEditDto(com.sequenceiq.environment.environment.dto.EnvironmentEditDto) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 9 with CheckPermissionByResourceName

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);
}
Also used : EnvironmentChangeCredentialDto(com.sequenceiq.environment.environment.dto.EnvironmentChangeCredentialDto) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CheckPermissionByRequestProperty(com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Example 10 with CheckPermissionByResourceName

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);
}
Also used : EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) UpdateAzureResourceEncryptionDto(com.sequenceiq.environment.environment.dto.UpdateAzureResourceEncryptionDto) CheckPermissionByResourceName(com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)

Aggregations

CheckPermissionByResourceName (com.sequenceiq.authorization.annotation.CheckPermissionByResourceName)29 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)7 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)6 Credential (com.sequenceiq.environment.credential.domain.Credential)4 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)3 CustomImage (com.sequenceiq.cloudbreak.domain.CustomImage)3 CheckPermissionByRequestProperty (com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty)2 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)2 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)2 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)2 SdxDatabaseBackupResponse (com.sequenceiq.sdx.api.model.SdxDatabaseBackupResponse)2 SdxDatabaseBackupStatusResponse (com.sequenceiq.sdx.api.model.SdxDatabaseBackupStatusResponse)2 ClusterTemplateV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.clustertemplate.responses.ClusterTemplateV4Response)1 CustomImageCatalogV4GetImageResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.customimage.response.CustomImageCatalogV4GetImageResponse)1 ImageCatalogV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response)1 StackScaleV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackScaleV4Request)1 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 ParametersQueryV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ParametersQueryV4Response)1 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1