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;
}
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);
}
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));
}
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);
}
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);
}
Aggregations