Search in sources :

Example 1 with QueueAuthorizationRulesSpreadsheetResult

use of org.haiku.haikudepotserver.api1.model.authorization.job.QueueAuthorizationRulesSpreadsheetResult in project haikudepotserver by haiku.

the class AuthorizationJobApiImpl method queueAuthorizationRulesSpreadsheet.

@Override
public QueueAuthorizationRulesSpreadsheetResult queueAuthorizationRulesSpreadsheet(QueueAuthorizationRulesSpreadsheetRequest request) {
    Preconditions.checkArgument(null != request, "a request objects is required");
    final ObjectContext context = serverRuntime.newContext();
    User user = obtainAuthenticatedUser(context);
    if (!permissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), null, Permission.AUTHORIZATION_CONFIGURE)) {
        String msg = "attempt to queue authorization spreadsheet without sufficient authorization";
        LOGGER.warn(msg);
        throw new AccessDeniedException(msg);
    }
    QueueAuthorizationRulesSpreadsheetResult result = new QueueAuthorizationRulesSpreadsheetResult();
    result.guid = jobService.submit(new AuthorizationRulesSpreadsheetJobSpecification(), JobSnapshot.COALESCE_STATUSES_QUEUED_STARTED);
    return result;
}
Also used : QueueAuthorizationRulesSpreadsheetResult(org.haiku.haikudepotserver.api1.model.authorization.job.QueueAuthorizationRulesSpreadsheetResult) AccessDeniedException(org.springframework.security.access.AccessDeniedException) User(org.haiku.haikudepotserver.dataobjects.User) AuthorizationRulesSpreadsheetJobSpecification(org.haiku.haikudepotserver.security.model.AuthorizationRulesSpreadsheetJobSpecification) ObjectContext(org.apache.cayenne.ObjectContext)

Aggregations

ObjectContext (org.apache.cayenne.ObjectContext)1 QueueAuthorizationRulesSpreadsheetResult (org.haiku.haikudepotserver.api1.model.authorization.job.QueueAuthorizationRulesSpreadsheetResult)1 User (org.haiku.haikudepotserver.dataobjects.User)1 AuthorizationRulesSpreadsheetJobSpecification (org.haiku.haikudepotserver.security.model.AuthorizationRulesSpreadsheetJobSpecification)1 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1