资源与权限码说明
资源


资源定义在org.camunda.bpm.engine.authorization.Resources 类中
public enum Resources implements Resource {APPLICATION(EntityTypes.APPLICATION, 0),USER(EntityTypes.USER, 1),GROUP(EntityTypes.GROUP, 2),GROUP_MEMBERSHIP(EntityTypes.GROUP_MEMBERSHIP, 3),AUTHORIZATION(EntityTypes.AUTHORIZATION, 4),FILTER(EntityTypes.FILTER, 5),PROCESS_DEFINITION(EntityTypes.PROCESS_DEFINITION, 6),TASK(EntityTypes.TASK, 7),PROCESS_INSTANCE(EntityTypes.PROCESS_INSTANCE, 8),DEPLOYMENT(EntityTypes.DEPLOYMENT, 9),DECISION_DEFINITION(EntityTypes.DECISION_DEFINITION, 10),TENANT(EntityTypes.TENANT, 11),TENANT_MEMBERSHIP(EntityTypes.TENANT_MEMBERSHIP, 12),BATCH(EntityTypes.BATCH, 13),DECISION_REQUIREMENTS_DEFINITION(EntityTypes.DECISION_REQUIREMENTS_DEFINITION, 14),REPORT(EntityTypes.REPORT, 15),DASHBOARD(EntityTypes.DASHBOARD, 16);String name;int id;Resources(String name, int id) {this.name = name;this.id = id;}public String resourceName() {return name;}public int resourceType() {return id;}}
授权系列
查询用户权限
给用户权限
授权登陆
Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);authorization.setGroupId(null);authorization.setResourceId("*");authorization.setUserId("gjf1");authorization.setResource(Resources.APPLICATION);authorization.setPermissions(new Permission[]{Permissions.ACCESS});authorizationService.saveAuthorization(authorization);
授权操作组,租户,权限等资源
authorization.setResource(“修改此处资源即可”);
授权用户操作cockpit项目
超级管理员使用

DatabasePrefixHandler 的使用
public class DatabasePrefixHandler {protected Pattern pattern = Pattern.compile("^\\{(.*?)\\}");//添加大括号public String generatePrefix(String algorithmName){return "{" + algorithmName + "}";}//public String retrieveAlgorithmName(String encryptedPasswordWithPrefix) {Matcher matcher = pattern.matcher(encryptedPasswordWithPrefix);if(matcher.find()){return matcher.group(1);}return null;}public String removePrefix(String encryptedPasswordWithPrefix) {int index = encryptedPasswordWithPrefix.indexOf("}");if(!encryptedPasswordWithPrefix.startsWith("{") || index < 0){return null;}return encryptedPasswordWithPrefix.substring(index+1);}}
