How to integrate Identity System in Activity

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to integrate Identity System in Activity相关的知识,希望对你有一定的参考价值。

Reference:
http://activiti.org/userguide/index.html?_ga=1.41496610.1079305175.1466499422#bpmnUserTask
----------------------------------------------------------------------------------------------------------------------
User assignment

A user task can be directly assigned to a user. This is done by defining a humanPerformer sub element. Such a humanPerformerdefinition needs a resourceAssignmentExpression that actually defines the user. Currently, only formalExpressions are supported.

1 2 3 4 5 6 7 8 9 10 11
<process > ... <userTask id=‘theTask‘ name=‘important task‘ > <humanPerformer> <resourceAssignmentExpression> <formalExpression>kermit</formalExpression> </resourceAssignmentExpression> </humanPerformer> </userTask>

Only one user can be assigned as human performer to the task. In Activiti terminology, this user is called the assignee. Tasks that have an assignee are not visible in the task lists of other people and can be found in the so-called personal task list of the assignee instead.

Tasks directly assigned to users can be retrieved through the TaskService as follows:

1
List<Task> tasks = taskService.createTaskQuery().taskAssignee("kermit").list();

Tasks can also be put in the so-called candidate task list of people. In that case, the potentialOwner construct must be used. The usage is similar to the humanPerformer construct. Do note that it is required to define for each element in the formal expression to specify if it is a user or a group (the engine cannot guess this).

1 2 3 4 5 6 7 8 9 10 11
<process > ... <userTask id=‘theTask‘ name=‘important task‘ > <potentialOwner> <resourceAssignmentExpression> <formalExpression>user(kermit), group(management)</formalExpression> </resourceAssignmentExpression> </potentialOwner> </userTask>

Tasks defines with the potential owner construct, can be retrieved as follows (or a similar TaskQuery usage as for the tasks with an assignee):

1
List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("kermit");

This will retrieve all tasks where kermit is a candidate user, i.e. the formal expression contains user(kermit). This will also retrieve all tasks that are assigned to a group where kermit is a member of (e.g. group(management), if kermit is a member of that group and the Activiti identity component is used). The groups of a user are resolved at runtime and these can be managed through theIdentityService.

If no specifics are given whether the given text string is a user or group, the engine defaults to group. So the following would be the same as when group(accountancy) was declared.

1
<formalExpression>accountancy</formalExpression>
Activiti extensions for task assignment

It is clear that user and group assignments are quite cumbersome for use cases where the assignment is not complex. To avoid these complexities, custom extensions on the user task are possible.

  • assignee attribute: this custom extension allows to directly assign a user task to a given user.

1
<userTask id="theTask" name="my task" activiti:assignee="kermit" />

This is exactly the same as using a humanPerformer construct as defined above.

  • candidateUsers attribute: this custom extension allows to make a user a candidate for a task.

1
<userTask id="theTask" name="my task" activiti:candidateUsers="kermit, gonzo" />

This is exactly the same as using a potentialOwner construct as defined above. Note that it is not required to use the user(kermit)declaration as is the case with the potential owner construct, since the attribute can only be used for users.

  • candidateGroups attribute: this custom extension allows to make a group a candidate for a task.

1
<userTask id="theTask" name="my task" activiti:candidateGroups="management, accountancy" />

This is exactly the same as using a potentialOwner construct as defined above. Note that it is not required to use thegroup(management) declaration as is the case with the potential owner construct, since the attribute can only be used for groups.

  • candidateUsers and candidateGroups can both be defined on the same user task.

Note: Although Activiti provides an identity management component, which is exposed through the IdentityService, no check is done whether a provided user is known by the identity component. This allows Activiti to integrate with existing identity management solutions when it is embedded into an application.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

For example:

taskService.claim("62556", "user1");

user1 is a userID, it should be saved in pt_wf_id_user, but if it does‘t exist, the claim function can also be executed successful.

 

以上是关于How to integrate Identity System in Activity的主要内容,如果未能解决你的问题,请参考以下文章

[转]How to: Create a Custom Principal Identity

How to Alter a table for Identity Specification is identity SQL Server

How-to centralized integration of eventbridge event notifications sent to feishu

css PureCSS菜单进入WordPress(http://corpocrat.com/2015/08/28/how-to-integrate-purecss-navigation-menu-in

Microsoft.AspNet.Identity: UserID用整型数据表示, 而不是GUID

sql内连接单表