Tools
Sign in
Login
Forum
How to detect if a user has access to a workitem?
Forum
>
Ask Anything
>
How to detect if a user has access to a workitem?
Dali Li
posted
on May 24, 2013
at 3:40 PM
Dali Li
posted
on May 24, 2013
at 3:40 PM
If user don't have access to a workitem we are showing some error message on the screen. I need to create a script funtion for this so it can be reused. Any one know about the details?
Thomas Suter
replied
on May 24, 2013
at 4:11 PM
Thomas Suter
replied
on May 24, 2013
at 4:11 PM
A user may resume a workitem if the following expression returns true:
1
// $wi is referencing the workitem to be inspected
2
Workitem $wi;
3
// $user is referencing the current user
4
User $user := USER();
5
// appway allows to resume the workitem $wi for user $user if:
6
If $wi.getQueueName() == $user.getUserId() Then
7
// - the workitem is assigned to the user
8
Return true;
9
ElseIf STARTSWITH($wi.getQueueName(), 'ROLE:') and $user.isInRole(SUBSTRING($wi.getQueueName(), 5)) Then
10
// - the workitem is assinged to a role the user belongs to
11
Return true;
12
ElseIf STARTSWITH($wi.getQueueName(), 'GROUP:') and $user.isInGroup(SUBSTRING($wi.getQueueName(), 6)) Then
13
// - the workitem is assigned to a group the user belongs to
14
Return true;
15
Else
16
// the user may not resume the workitem
17
Return false;
18
End
Please note that above policy may further be restricted based on additional business related policies.
Stephan
replied
on May 27, 2013
at 8:19 AM
Stephan
replied
on May 27, 2013
at 8:19 AM
... or you simply use the built-in function "ProcessQueueCheckAccess(...)".
1
Workitem $workitem := ...;
2
String $userId := USERID();
3
String $queueName := $workitem.getQueueName();
4
Return ProcessQueueCheckAccess($userId, $queueName);
Please
sign in
to add a reply
About this site
|
Terms of use
|
Privacy statement
|
Contact us
© 2025 Appway AG. All Rights Reserved.