Activiti源码浅析:Activiti的活动授权机制
2015-01-28 15:16
573 查看
http://blog.csdn.net/bluejoe2000/article/details/40663419
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操作方法:
[html] view
plaincopy
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:
[java] view
plaincopy
public void addCandidateUser(String userId) {
addIdentityLink(userId, null, IdentityLinkType.CANDIDATE);
}
[html] view
plaincopy
public void addCandidateGroup(String groupId) {
addIdentityLink(null, groupId, IdentityLinkType.CANDIDATE);
}
如下查询语句对应于“用户kermit待签收任务列表”的调用过程:
[html] view
plaincopy
Preparing: select distinct RES.* from AC
T_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")
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 taskTaskEntity包含了一系列的IdentityLink操作方法:
[html] view
plaincopy
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:
[java] view
plaincopy
public void addCandidateUser(String userId) {
addIdentityLink(userId, null, IdentityLinkType.CANDIDATE);
}
[html] view
plaincopy
public void addCandidateGroup(String groupId) {
addIdentityLink(null, groupId, IdentityLinkType.CANDIDATE);
}
2. IdentityLink与权限过滤
如下查询语句对应于“用户kermit待签收任务列表”的调用过程:[html] view
plaincopy
Preparing: select distinct RES.* from AC
T_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")
相关文章推荐
- Activiti源码浅析:Activiti的活动授权机制
- Activiti源码浅析:Activiti的活动授权机制
- Activiti源码浅析:Activiti的活动授权机制
- Activiti源码浅析:Activiti的活动授权机制
- Activiti源码浅析:Activity与Task
- Chromium源码浅析 --- Chromium的多线程机制
- Activiti源码浅析:Activity与Task
- Android 源码 listview 重用机制 浅析
- 浅析安卓事件分发机制源码
- Activiti源码浅析:Activity与Task
- Glide缓存机制源码浅析
- 【Spark Core】任务执行机制和Task源码浅析2
- seajs源码分析-运行机制浅析(一)
- Activiti源码浅析:Activity与Task
- 【Spark Core】任务执行机制和Task源码浅析1
- [收藏].NET 1.1中预编译ASP.NET页面实现原理浅析 [1] 自动预编译机制浅析
- Atlas 实现机制浅析 [3]
- CommunityServer 2.0中Files 与 Reader 项目的授权机制
- 【AjaxPro实现机制浅析一】AjaxPro内部为我们做什么工作?
- BO2k源码分析(二)----命令循环机制