use of com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty in project cloudbreak by hortonworks.
the class FreeIpaV1Controller method create.
@Override
@CheckPermissionByRequestProperty(path = "environmentCrn", type = CRN, action = EDIT_ENVIRONMENT)
public DescribeFreeIpaResponse create(@RequestObject @Valid CreateFreeIpaRequest request) {
ValidationResult validationResult = createFreeIpaRequestValidator.validate(request);
if (validationResult.getState() == State.ERROR) {
LOGGER.debug("FreeIPA request has validation error(s): {}.", validationResult.getFormattedErrors());
throw new BadRequestException(validationResult.getFormattedErrors());
}
String accountId = crnService.getCurrentAccountId();
return freeIpaCreationService.launchFreeIpa(request, accountId);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty in project cloudbreak by hortonworks.
the class EnvironmentController method post.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_ENVIRONMENT)
@CheckPermissionByRequestProperty(path = "credentialName", type = NAME, action = DESCRIBE_CREDENTIAL)
public DetailedEnvironmentResponse post(@RequestObject @Valid EnvironmentRequest request) {
EnvironmentCreationDto environmentCreationDto = environmentApiConverter.initCreationDto(request);
EnvironmentDto envDto = environmentCreationService.create(environmentCreationDto);
return environmentResponseConverter.dtoToDetailedResponse(envDto);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty 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.CheckPermissionByRequestProperty in project cloudbreak by hortonworks.
the class SdxController method changeImageCatalog.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.CHANGE_IMAGE_CATALOG_DATALAKE)
@CheckPermissionByRequestProperty(type = NAME, path = "imageCatalog", action = DESCRIBE_IMAGE_CATALOG)
public void changeImageCatalog(@ResourceName String name, @RequestObject SdxChangeImageCatalogRequest changeImageCatalogRequest) {
SdxCluster sdxCluster = getSdxClusterByName(name);
sdxImageCatalogService.changeImageCatalog(sdxCluster, changeImageCatalogRequest.getImageCatalog());
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty in project cloudbreak by hortonworks.
the class CredentialV1Controller method put.
@Override
@CheckPermissionByRequestProperty(path = "name", type = NAME, action = EDIT_CREDENTIAL)
public CredentialResponse put(@RequestObject @Valid EditCredentialRequest credentialRequest) {
Credential credential = credentialConverter.convert(credentialRequest);
credential.setType(ENVIRONMENT);
credential = credentialService.updateByAccountId(credential, ThreadBasedUserCrnProvider.getAccountId(), ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_MODIFIED);
return credentialConverter.convert(credential);
}
Aggregations