use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentController method changeTelemetryFeaturesByEnvironmentCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.EDIT_ENVIRONMENT)
public DetailedEnvironmentResponse changeTelemetryFeaturesByEnvironmentCrn(@ValidCrn(resource = CrnResourceDescriptor.ENVIRONMENT) @ResourceCrn String crn, @Valid FeaturesRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
EnvironmentFeatures features = environmentApiConverter.convertToEnvironmentTelemetryFeatures(request);
EnvironmentDto result = environmentModificationService.changeTelemetryFeaturesByEnvironmentCrn(accountId, crn, features);
return environmentResponseConverter.dtoToDetailedResponse(result);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class CredentialV1Controller method getByEnvironmentCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT)
public CredentialResponse getByEnvironmentCrn(@TenantAwareParam @ResourceCrn String environmentCrn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId, ENVIRONMENT);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class CredentialV1Controller method verifyByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL)
public CredentialResponse verifyByCrn(@TenantAwareParam @ResourceCrn String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByCrnForAccountId(crn, accountId, ENVIRONMENT);
Credential verifiedCredential = credentialService.verify(credential);
return credentialConverter.convert(verifiedCredential);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class CredentialV1Controller method deleteByResourceCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CREDENTIAL)
public CredentialResponse deleteByResourceCrn(@TenantAwareParam @ResourceCrn String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential deleted = credentialDeleteService.deleteByCrn(crn, accountId, ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_DELETED);
return credentialConverter.convert(deleted);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByResourceCrn in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getCloudNetworks.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformNetworksResponse getCloudNetworks(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone, String sharedProjectId) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, sharedProjectId);
LOGGER.info("Get /platform_resources/networks, request: {}", request);
CloudNetworks networks = platformParameterService.getCloudNetworks(request);
PlatformNetworksResponse response = cloudNetworksToPlatformNetworksV1ResponseConverter.convert(networks);
LOGGER.info("Resp /platform_resources/networks, request: {}, networks: {}, response: {}", request, networks, response);
return response;
}
Aggregations