use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidator in project webprotege by protegeproject.
the class GetApplicationPreferencesActionHandler_TestCase method shouldCheckForPermission.
@Test
public void shouldCheckForPermission() {
RequestValidator validator = handler.getRequestValidator(action, requestContext);
RequestValidationResult result = validator.validateAction();
assertThat(result.isInvalid(), is(true));
verify(accessManager, times(1)).hasPermission(forUser(userId), ApplicationResource.get(), EDIT_APPLICATION_SETTINGS.getActionId());
}
use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidator in project webprotege by protegeproject.
the class CreateNewProjectActionHandler_TestCase method shouldNotAllowGuestsToCreateProjects.
@Test
public void shouldNotAllowGuestsToCreateProjects() {
when(userId.isGuest()).thenReturn(true);
CreateNewProjectAction action = new CreateNewProjectAction(newProjectSettings);
RequestValidator validator = handler.getRequestValidator(action, requestContext);
RequestValidationResult validationResult = validator.validateAction();
assertThat(validationResult.isValid(), is(false));
}
use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidator in project webprotege by protegeproject.
the class GetProjectPermissionsActionHandler_TestCase method shouldAllowAnyOneToRetrievePermissions.
@Test
public void shouldAllowAnyOneToRetrievePermissions() {
RequestContext requestContext = mock(RequestContext.class);
when(requestContext.getUserId()).thenReturn(UserId.getGuest());
RequestValidator validator = handler.getRequestValidator(action, requestContext);
assertThat(validator.validateAction().isValid(), is(true));
}
Aggregations