use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class SdxInternalController method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE)
public SdxClusterResponse create(String name, @Valid SdxInternalClusterRequest createSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.createSdx(userCrn, name, createSdxClusterRequest, createSdxClusterRequest.getStackV4Request());
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.INTERNAL_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class SdxController method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_DATALAKE)
public SdxClusterResponse create(String name, @Valid SdxCustomClusterRequest createSdxClusterRequest) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Pair<SdxCluster, FlowIdentifier> result = sdxService.createSdx(userCrn, name, createSdxClusterRequest);
SdxCluster sdxCluster = result.getLeft();
metricService.incrementMetricCounter(MetricType.CUSTOM_SDX_REQUESTED, sdxCluster);
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
sdxClusterResponse.setName(sdxCluster.getClusterName());
sdxClusterResponse.setFlowIdentifier(result.getRight());
return sdxClusterResponse;
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class AccountTelemetryController method testRulePattern.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public TestAnonymizationRuleResponse testRulePattern(TestAnonymizationRuleRequest request) {
TestAnonymizationRuleResponse response = new TestAnonymizationRuleResponse();
response.setOutput(accountTelemetryService.testRulePatterns(request.getRules(), request.getInput()));
return response;
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class EventV4Controller method getPagedCloudbreakEventListByCrn.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public List<CloudbreakEventV4Response> getPagedCloudbreakEventListByCrn(@TenantAwareParam String crn, Integer page, Integer size, boolean onlyAlive) {
PageRequest pageable = PageRequest.of(page, size, Sort.by("timestamp").descending());
StackView stackView;
if (onlyAlive) {
stackView = getStackViewByCrnIfAvailable(crn);
} else {
stackView = getStackViewByCrn(crn);
}
return cloudbreakEventsFacade.retrieveEventsByStack(stackView.getId(), stackView.getType(), pageable).getContent();
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class ImageCatalogV4Controller method create.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_IMAGE_CATALOG)
public ImageCatalogV4Response create(Long workspaceId, ImageCatalogV4Request request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String creator = ThreadBasedUserCrnProvider.getUserCrn();
ImageCatalog catalogToSave = imageCatalogV4RequestToImageCatalogConverter.convert(request);
ImageCatalog imageCatalog = imageCatalogService.createForLoggedInUser(catalogToSave, restRequestThreadLocalService.getRequestedWorkspaceId(), accountId, creator);
notify(ResourceEvent.IMAGE_CATALOG_CREATED);
return imageCatalogToImageCatalogV4ResponseConverter.convert(imageCatalog);
}
Aggregations