Search in sources :

Example 1 with Permission

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

the class DefaultAuthorizationProvider method createGrantAuthorization.

protected AuthorizationEntity createGrantAuthorization(String userId, String groupId, Resource resource, String resourceId, Permission... permissions) {
    // assuming that there are no default authorizations for *
    if (userId != null) {
        ensureValidIndividualResourceId("Cannot create authorization for user " + userId, userId);
    }
    if (groupId != null) {
        ensureValidIndividualResourceId("Cannot create authorization for group " + groupId, groupId);
    }
    AuthorizationEntity authorization = new AuthorizationEntity(AUTH_TYPE_GRANT);
    authorization.setUserId(userId);
    authorization.setGroupId(groupId);
    authorization.setResource(resource);
    authorization.setResourceId(resourceId);
    if (permissions != null) {
        for (Permission permission : permissions) {
            authorization.addPermission(permission);
        }
    }
    return authorization;
}
Also used : AuthorizationEntity(org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity) Permission(org.camunda.bpm.engine.authorization.Permission)

Example 2 with Permission

use of org.camunda.bpm.engine.authorization.Permission 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)

Example 3 with Permission

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

Example 4 with Permission

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

the class GroupAuthorizationTest method createGroupGrantAuthorization.

protected void createGroupGrantAuthorization(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 5 with Permission

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

the class AuthorizationTest method createRevokeAuthorization.

protected void createRevokeAuthorization(Resource resource, String resourceId, String userId, Permission... permissions) {
    Authorization authorization = createRevokeAuthorization(resource, resourceId);
    authorization.setUserId(userId);
    for (Permission permission : permissions) {
        authorization.removePermission(permission);
    }
    saveAuthorization(authorization);
}
Also used : Authorization(org.camunda.bpm.engine.authorization.Authorization) 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