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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations