use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class CredentialV1Controller method post.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public CredentialResponse post(@Valid CredentialRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String creator = ThreadBasedUserCrnProvider.getUserCrn();
Credential credential = credentialConverter.convert(request);
credential.setType(ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_CREATED);
return credentialConverter.convert(credentialService.create(credential, accountId, creator, ENVIRONMENT));
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class CredentialV1Controller method authorizeCodeGrantFlow.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public CredentialResponse authorizeCodeGrantFlow(String platform, String code, String state) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.authorizeCodeGrantFlow(code, state, accountId, platform);
notify(ResourceEvent.CREDENTIAL_CREATED);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class DatabaseServerV4Controller method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATABASE_SERVER)
public DatabaseServerStatusV4Response create(AllocateDatabaseServerV4Request request) {
MDCBuilder.addEnvironmentCrn(request.getEnvironmentCrn());
DBStack dbStack = dbStackConverter.convert(request, ThreadBasedUserCrnProvider.getUserCrn());
DBStack savedDBStack = redbeamsCreationService.launchDatabaseServer(dbStack, request.getClusterCrn());
return dbStackToDatabaseServerStatusV4ResponseConverter.convert(savedDBStack);
}
Aggregations