Search in sources :

Example 31 with CheckPermissionByAccount

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));
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 32 with CheckPermissionByAccount

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);
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 33 with CheckPermissionByAccount

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);
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Aggregations

CheckPermissionByAccount (com.sequenceiq.authorization.annotation.CheckPermissionByAccount)33 Credential (com.sequenceiq.environment.credential.domain.Credential)8 ProxyConfig (com.sequenceiq.environment.proxy.domain.ProxyConfig)4 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)3 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)3 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)3 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)3 PageRequest (org.springframework.data.domain.PageRequest)3 AuthorizationResourceAction (com.sequenceiq.authorization.resource.AuthorizationResourceAction)2 AccountId (com.sequenceiq.cloudbreak.auth.security.internal.AccountId)2 TenantAwareParam (com.sequenceiq.cloudbreak.auth.security.internal.TenantAwareParam)2 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)2 ProxyResponse (com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse)2 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)2 Controller (org.springframework.stereotype.Controller)2 CheckPermissionByRequestProperty (com.sequenceiq.authorization.annotation.CheckPermissionByRequestProperty)1 EventV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.events.EventV4Endpoint)1 CloudbreakEventV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.events.responses.CloudbreakEventV4Response)1 CloudbreakEventV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.events.responses.CloudbreakEventV4Responses)1 ResourceEventResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ResourceEventResponse)1