Search in sources :

Example 6 with Authorization

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;
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization)

Example 7 with Authorization

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;
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization)

Example 8 with Authorization

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;
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization)

Example 9 with Authorization

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;
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization)

Example 10 with 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);
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization) Permission(org.camunda.bpm.engine.authorization.Permission)

Aggregations

Authorization (org.camunda.bpm.engine.authorization.Authorization)117 MissingAuthorization (org.camunda.bpm.engine.authorization.MissingAuthorization)26 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)22 User (org.camunda.bpm.engine.identity.User)20 Test (org.junit.Test)17 AuthorizationQuery (org.camunda.bpm.engine.authorization.AuthorizationQuery)16 Group (org.camunda.bpm.engine.identity.Group)13 Permission (org.camunda.bpm.engine.authorization.Permission)12 AuthorizationService (org.camunda.bpm.engine.AuthorizationService)9 Tenant (org.camunda.bpm.engine.identity.Tenant)9 AuthorizationDto (org.camunda.bpm.engine.rest.dto.authorization.AuthorizationDto)8 Matchers.anyString (org.mockito.Matchers.anyString)7 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 IdentityService (org.camunda.bpm.engine.IdentityService)3 Resource (org.camunda.bpm.engine.authorization.Resource)3 TenantEntity (org.camunda.bpm.engine.impl.persistence.entity.TenantEntity)3 Before (org.junit.Before)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Filter (org.camunda.bpm.engine.filter.Filter)2