use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class LdapUserQueryTest method createAuthorization.
protected Authorization createAuthorization(int type, Resource resource, String resourceId) {
Authorization authorization = authorizationService.createNewAuthorization(type);
authorization.setResource(resource);
if (resourceId != null) {
authorization.setResourceId(resourceId);
}
return authorization;
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class LdapDisableAuthorizationCheckTest method createGrantAuthorization.
protected void createGrantAuthorization(Resource resource, String resourceId, String userId, Permission... permissions) {
Authorization authorization = createAuthorization(AUTH_TYPE_GRANT, resource, resourceId);
authorization.setUserId(userId);
for (Permission permission : permissions) {
authorization.addPermission(permission);
}
authorizationService.saveAuthorization(authorization);
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class LdapDisableAuthorizationCheckTest method testGroupQueryPaginationWithAuthenticatedUserWithAuthorizations.
public void testGroupQueryPaginationWithAuthenticatedUserWithAuthorizations() {
createGrantAuthorization(GROUP, "management", "oscar", READ);
createGrantAuthorization(GROUP, "consulting", "oscar", READ);
createGrantAuthorization(GROUP, "external", "oscar", READ);
try {
processEngineConfiguration.setAuthorizationEnabled(true);
identityService.setAuthenticatedUserId("oscar");
testGroupPaging(identityService);
} finally {
processEngineConfiguration.setAuthorizationEnabled(false);
identityService.clearAuthentication();
for (Authorization authorization : authorizationService.createAuthorizationQuery().list()) {
authorizationService.deleteAuthorization(authorization.getId());
}
}
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class LdapDisableAuthorizationCheckTest method createAuthorization.
protected Authorization createAuthorization(int type, Resource resource, String resourceId) {
Authorization authorization = authorizationService.createNewAuthorization(type);
authorization.setResource(resource);
if (resourceId != null) {
authorization.setResourceId(resourceId);
}
return authorization;
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationRestServiceInteractionTest method testCreateAuthorizationThrowsAuthorizationException.
@Test
public void testCreateAuthorizationThrowsAuthorizationException() {
String message = "expected authorization exception";
when(authorizationServiceMock.createNewAuthorization(Authorization.AUTH_TYPE_GRANT)).thenThrow(new AuthorizationException(message));
Authorization authorization = MockProvider.createMockGrantAuthorization();
AuthorizationDto dto = AuthorizationDto.fromAuthorization(authorization);
given().body(dto).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(AUTH_CREATE_PATH);
}
Aggregations