Search in sources :

Example 26 with CheckPermissionByAccount

use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.

the class UtilV4Controller method postNotificationTest.

@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ResourceEventResponse postNotificationTest() {
    CloudbreakUser cloudbreakUser = restRequestThreadLocalService.getCloudbreakUser();
    notificationSender.sendTestNotification(cloudbreakUser.getUserId());
    ResourceEventResponse response = new ResourceEventResponse();
    response.setEvent(ResourceEvent.CREDENTIAL_CREATED);
    return response;
}
Also used : ResourceEventResponse(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ResourceEventResponse) CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 27 with CheckPermissionByAccount

use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.

the class BlueprintV4Controller method post.

@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CLUSTER_TEMPLATE)
public BlueprintV4Response post(Long workspaceId, BlueprintV4Request request) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    String creator = ThreadBasedUserCrnProvider.getUserCrn();
    Blueprint toSave = blueprintV4RequestToBlueprintConverter.convert(request);
    Blueprint blueprint = blueprintService.createForLoggedInUser(toSave, restRequestThreadLocalService.getRequestedWorkspaceId(), accountId, creator);
    notify(ResourceEvent.BLUEPRINT_CREATED);
    return blueprintToBlueprintV4ResponseConverter.convert(blueprint);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 28 with CheckPermissionByAccount

use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.

the class ProxyController method post.

@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ProxyResponse post(ProxyRequest request) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    String creator = ThreadBasedUserCrnProvider.getUserCrn();
    ProxyConfig proxyConfig = proxyRequestToProxyConfigConverter.convert(request);
    notify(ResourceEvent.PROXY_CONFIG_CREATED);
    return proxyConfigToProxyResponseConverter.convert(proxyConfigService.create(proxyConfig, accountId, creator));
}
Also used : ProxyConfig(com.sequenceiq.environment.proxy.domain.ProxyConfig) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 29 with CheckPermissionByAccount

use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.

the class ProxyController method getByName.

@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ProxyResponse getByName(String name) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    ProxyConfig config = proxyConfigService.getByNameForAccountId(name, accountId);
    return proxyConfigToProxyResponseConverter.convert(config);
}
Also used : ProxyConfig(com.sequenceiq.environment.proxy.domain.ProxyConfig) CheckPermissionByAccount(com.sequenceiq.authorization.annotation.CheckPermissionByAccount)

Example 30 with CheckPermissionByAccount

use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.

the class AuditCredentialV1Controller method deleteByResourceCrn.

@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_AUDIT_CREDENTIAL)
public CredentialResponse deleteByResourceCrn(String crn) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    Credential deleted = credentialDeleteService.deleteByCrn(crn, accountId, AUDIT);
    notify(ResourceEvent.CREDENTIAL_DELETED);
    return credentialConverter.convert(deleted);
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) 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