Search in sources :

Example 1 with BuiltInAction

use of edu.stanford.bmir.protege.web.shared.access.BuiltInAction in project webprotege by protegeproject.

the class AbstractProjectActionHandler method getRequestValidator.

@Nonnull
@Override
public final RequestValidator getRequestValidator(@Nonnull A action, @Nonnull RequestContext requestContext) {
    List<RequestValidator> validators = new ArrayList<>();
    BuiltInAction builtInAction = getRequiredExecutableBuiltInAction();
    if (builtInAction != null) {
        ProjectPermissionValidator validator = new ProjectPermissionValidator(accessManager, action.getProjectId(), requestContext.getUserId(), builtInAction.getActionId());
        validators.add(validator);
    }
    ActionId reqActionId = getRequiredExecutableAction();
    if (reqActionId != null) {
        ProjectPermissionValidator validator = new ProjectPermissionValidator(accessManager, action.getProjectId(), requestContext.getUserId(), reqActionId);
        validators.add(validator);
    }
    Iterable<BuiltInAction> requiredExecutableBuiltInActions = getRequiredExecutableBuiltInActions();
    for (BuiltInAction actionId : requiredExecutableBuiltInActions) {
        ProjectPermissionValidator validator = new ProjectPermissionValidator(accessManager, action.getProjectId(), requestContext.getUserId(), actionId.getActionId());
        validators.add(validator);
    }
    final RequestValidator additionalRequestValidator = getAdditionalRequestValidator(action, requestContext);
    if (additionalRequestValidator != NullValidator.get()) {
        validators.add(additionalRequestValidator);
    }
    return CompositeRequestValidator.get(validators);
}
Also used : ProjectPermissionValidator(edu.stanford.bmir.protege.web.server.dispatch.validators.ProjectPermissionValidator) BuiltInAction(edu.stanford.bmir.protege.web.shared.access.BuiltInAction) ActionId(edu.stanford.bmir.protege.web.shared.access.ActionId) CompositeRequestValidator(edu.stanford.bmir.protege.web.server.dispatch.validators.CompositeRequestValidator) ArrayList(java.util.ArrayList) Nonnull(javax.annotation.Nonnull)

Aggregations

CompositeRequestValidator (edu.stanford.bmir.protege.web.server.dispatch.validators.CompositeRequestValidator)1 ProjectPermissionValidator (edu.stanford.bmir.protege.web.server.dispatch.validators.ProjectPermissionValidator)1 ActionId (edu.stanford.bmir.protege.web.shared.access.ActionId)1 BuiltInAction (edu.stanford.bmir.protege.web.shared.access.BuiltInAction)1 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1