博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Activiti源码浅析:Activiti的活动授权机制
阅读量:4318 次
发布时间:2019-06-06

本文共 1559 字,大约阅读时间需要 5 分钟。

1. IdentityLink与TaskEntity

An identity link is used to associate a task with a certain identity. For example: - a user can be an assignee (= identity link type) for a task - a group can be a candidate-group (= identity link type) for a task

TaskEntity包含了一系列的IdentityLink操作方法:

public IdentityLinkEntity addIdentityLink(String userId, String groupId, String type) {    IdentityLinkEntity identityLinkEntity = new IdentityLinkEntity();    getIdentityLinks().add(identityLinkEntity);    identityLinkEntity.setTask(this);    identityLinkEntity.setUserId(userId);    identityLinkEntity.setGroupId(groupId);    identityLinkEntity.setType(type);    identityLinkEntity.insert();    if (userId != null && processInstanceId != null) {      getProcessInstance().involveUser(userId, IdentityLinkType.PARTICIPANT);    }    return identityLinkEntity;  }
注意,IdentityLink有一个Type,有一些默认的Type:

public void addCandidateUser(String userId) {    addIdentityLink(userId, null, IdentityLinkType.CANDIDATE);  }

public void addCandidateGroup(String groupId) {    addIdentityLink(null, groupId, IdentityLinkType.CANDIDATE);  }

2. IdentityLink与权限过滤

如下查询语句对应于“用户kermit待签收任务列表”的调用过程:

Preparing: select distinct RES.* from ACT_RU_TASK RES inner join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = RES.ID_ WHERE RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and ( I.USER_ID_ = ? or I.GROUP_ID_ IN ( ? , ? ) ) Parameters: kermit(String), admin(String), management(String)
其中admin和management来自于用户群组关系查询接口:

UserEntityManager.findGroupsByUser("kermit")

转载于:https://www.cnblogs.com/bluejoe/p/5115942.html

你可能感兴趣的文章
07-Java 中的IO操作
查看>>
uclibc,eglibc,glibc之间的区别和联系【转】
查看>>
Java魔法堂:找外援的利器——Runtime.exec详解
查看>>
mysql数据库存放路径
查看>>
TestNG(五)常用元素的操作
查看>>
解决 Visual Studio 点击添加引用无反应的问题
查看>>
通过镜像下载Android系统源码
查看>>
python字符串格式化 %操作符 {}操作符---总结
查看>>
windows 不能在 本地计算机 启动 Apache
查看>>
iOS开发报duplicate symbols for architecture x86_64错误的问题
查看>>
Chap-6 6.4.2 堆和栈
查看>>
【Java学习笔记之九】java二维数组及其多维数组的内存应用拓展延伸
查看>>
C# MySql 连接
查看>>
sk_buff Structure
查看>>
oracle的级联更新、删除
查看>>
多浏览器开发需要注意的问题之一
查看>>
Maven配置
查看>>
HttpServletRequest /HttpServletResponse
查看>>
SAM4E单片机之旅——24、使用DSP库求向量数量积
查看>>
从远程库克隆库
查看>>