BPM ADF Task forms. Checking whether the current user is in a BPM Swimlane
Posted
by Christopher Karl Chan
on Oracle Blogs
See other posts from Oracle Blogs
or by Christopher Karl Chan
Published on Wed, 19 Sep 2012 19:02:14 +0000
Indexed on
2012/09/19
21:44 UTC
Read the original article
Hit count: 378
/BPM
Focus
So this blog entry will focus on BPM Swimlane roles and users from a ADF context.
So we have an ADF Task Details Form and we are in the process of making it richer and dynamic in functionality. A common requirement could be to dynamically show different areas based on the user logged into the workspace. Perhaps even we want to know even what swim-lane role the user belongs to.
It is is a little bit harder to achieve then one thinks unless you know the trick.
The Challenge
The tricky part here is that the ADF Task Details Form is in fact part of a separate J2EE application to the main workspace. So if you try to use Java or Expression Language to get the logged in user you will only find anonymous and none of the BPM Roles you will be expecting. So what to do?
The Magic
First add the BC4J Security library to your view project.
Then Restart JDeveloper.
Now find the web.xml file in the view project of your ADF Task Details Application and look for the JpsFilter section. Then add in the following section.
<init-param>
<param-name>application.name</param-name>
<param-value>OracleBPMProcessRolesApp</param-value>
</init-param>
This will link your application to that of the BPM workspace.
Then in your dynamic part of your ADF form you can now check whether the user logged into the BPM Workspace belongs in a BPM swim-lane in any BPM process. The best way to do this is by using expression language in the JSF page itself. Here I am simply changing the rendered flag to either true or false and thereby hiding or showing a section.
Perhaps you are re-using the same form for a task in an approver swim-lane and ordinary user swimlane. So we only want the approver to see this field.
So call the built in function to check if the user is a member of the BPM swim-lane role. The name of the role must be of the syntax BPMProject.RoleName
<af:outputText value="This will only be rendered when the user is part of the BPM Swimlane Role
rendered="#{securityContext.userInRole['BPMProjectName.Rolename']}"/>
Now you must redeploy your ADF Task Form project
Now (in the image above) the text will ONLY get rendered in the Task Details Form only if the user logged into the workspace is a member of the swimlane Unsecure of the BPM project SimpleTask
© Oracle Blogs or respective owner