Search in sources :

Example 6 with Permission

use of org.camunda.bpm.engine.authorization.Permission in project camunda-bpm-platform by camunda.

the class AuthorizationTest method createGrantAuthorizationGroup.

protected void createGrantAuthorizationGroup(Resource resource, String resourceId, String groupId, Permission... permissions) {
    Authorization authorization = createGrantAuthorization(resource, resourceId);
    authorization.setGroupId(groupId);
    for (Permission permission : permissions) {
        authorization.addPermission(permission);
    }
    saveAuthorization(authorization);
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization) Permission(org.camunda.bpm.engine.authorization.Permission)

Example 7 with Permission

use of org.camunda.bpm.engine.authorization.Permission in project camunda-bpm-platform by camunda.

the class MissingAuthorizationMatcher method asMissingAuthorization.

protected static MissingAuthorization asMissingAuthorization(Authorization authorization) {
    String permissionName = null;
    String resourceId = null;
    String resourceName = null;
    for (Permission permission : authorization.getPermissions(Permissions.values())) {
        if (permission != Permissions.NONE) {
            permissionName = permission.getName();
            break;
        }
    }
    if (!Authorization.ANY.equals(authorization.getResourceId())) {
        // missing ANY authorizations are not explicitly represented in the error message
        resourceId = authorization.getResourceId();
    }
    Resource resource = AuthorizationTestUtil.getResourceByType(authorization.getResourceType());
    resourceName = resource.resourceName();
    return new MissingAuthorization(permissionName, resourceName, resourceId);
}
Also used : MissingAuthorization(org.camunda.bpm.engine.authorization.MissingAuthorization) Permission(org.camunda.bpm.engine.authorization.Permission) Resource(org.camunda.bpm.engine.authorization.Resource)

Example 8 with Permission

use of org.camunda.bpm.engine.authorization.Permission in project camunda-bpm-platform by camunda.

the class AuthorizationQueryTest method createAuthorization.

protected void createAuthorization(String userId, String groupId, Resource resourceType, String resourceId, Permission... permissions) {
    Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    authorization.setUserId(userId);
    authorization.setGroupId(groupId);
    authorization.setResource(resourceType);
    authorization.setResourceId(resourceId);
    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)

Example 9 with Permission

use of org.camunda.bpm.engine.authorization.Permission in project camunda-bpm-platform by camunda.

the class AuthorizationPerformanceTestCase method userGrant.

protected void userGrant(String userId, Resource resource, Permission... perms) {
    AuthorizationService authorizationService = engine.getAuthorizationService();
    Authorization groupGrant = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
    groupGrant.setResource(resource);
    groupGrant.setResourceId(ANY);
    for (Permission permission : perms) {
        groupGrant.addPermission(permission);
    }
    groupGrant.setUserId(userId);
    authorizationService.saveAuthorization(groupGrant);
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization) AuthorizationService(org.camunda.bpm.engine.AuthorizationService) Permission(org.camunda.bpm.engine.authorization.Permission)

Example 10 with Permission

use of org.camunda.bpm.engine.authorization.Permission in project camunda-bpm-platform by camunda.

the class AuthorizationPerformanceTestCase method grouptGrant.

protected void grouptGrant(String groupId, Resource resource, Permission... perms) {
    AuthorizationService authorizationService = engine.getAuthorizationService();
    Authorization groupGrant = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
    groupGrant.setResource(resource);
    groupGrant.setResourceId(ANY);
    for (Permission permission : perms) {
        groupGrant.addPermission(permission);
    }
    groupGrant.setGroupId(groupId);
    authorizationService.saveAuthorization(groupGrant);
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization) AuthorizationService(org.camunda.bpm.engine.AuthorizationService) Permission(org.camunda.bpm.engine.authorization.Permission)

Aggregations

Permission (org.camunda.bpm.engine.authorization.Permission)20 Authorization (org.camunda.bpm.engine.authorization.Authorization)12 AuthorizationEntity (org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity)4 ArrayList (java.util.ArrayList)2 AuthorizationService (org.camunda.bpm.engine.AuthorizationService)2 MissingAuthorization (org.camunda.bpm.engine.authorization.MissingAuthorization)2 Resource (org.camunda.bpm.engine.authorization.Resource)2