use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class MockProvider method createMockGlobalAuthorization.
public static Authorization createMockGlobalAuthorization() {
Authorization mockAuthorization = mock(Authorization.class);
when(mockAuthorization.getId()).thenReturn(EXAMPLE_AUTHORIZATION_ID);
when(mockAuthorization.getAuthorizationType()).thenReturn(Authorization.AUTH_TYPE_GLOBAL);
when(mockAuthorization.getUserId()).thenReturn(Authorization.ANY);
when(mockAuthorization.getResourceType()).thenReturn(EXAMPLE_RESOURCE_TYPE_ID);
when(mockAuthorization.getResourceId()).thenReturn(EXAMPLE_RESOURCE_ID);
when(mockAuthorization.getPermissions(Permissions.values())).thenReturn(EXAMPLE_GRANT_PERMISSION_VALUES);
return mockAuthorization;
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class MockProvider method createMockGrantAuthorization.
public static Authorization createMockGrantAuthorization() {
Authorization mockAuthorization = mock(Authorization.class);
when(mockAuthorization.getId()).thenReturn(EXAMPLE_AUTHORIZATION_ID);
when(mockAuthorization.getAuthorizationType()).thenReturn(Authorization.AUTH_TYPE_GRANT);
when(mockAuthorization.getUserId()).thenReturn(EXAMPLE_USER_ID);
when(mockAuthorization.getResourceType()).thenReturn(EXAMPLE_RESOURCE_TYPE_ID);
when(mockAuthorization.getResourceId()).thenReturn(EXAMPLE_RESOURCE_ID);
when(mockAuthorization.getPermissions(Permissions.values())).thenReturn(EXAMPLE_GRANT_PERMISSION_VALUES);
return mockAuthorization;
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class MockProvider method createMockRevokeAuthorization.
public static Authorization createMockRevokeAuthorization() {
Authorization mockAuthorization = mock(Authorization.class);
when(mockAuthorization.getId()).thenReturn(EXAMPLE_AUTHORIZATION_ID);
when(mockAuthorization.getAuthorizationType()).thenReturn(Authorization.AUTH_TYPE_REVOKE);
when(mockAuthorization.getUserId()).thenReturn(EXAMPLE_USER_ID);
when(mockAuthorization.getResourceType()).thenReturn(EXAMPLE_RESOURCE_TYPE_ID);
when(mockAuthorization.getResourceId()).thenReturn(EXAMPLE_RESOURCE_ID);
when(mockAuthorization.getPermissions(Permissions.values())).thenReturn(EXAMPLE_REVOKE_PERMISSION_VALUES);
return mockAuthorization;
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class LdapGroupQueryTest 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 LdapUserQueryTest 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);
}
Aggregations