Workflows: Get initiator in a workflow route
In an OR step for a workflow, I need to know the initiator user to decide if the route should be true or false, based on user roles.
In a workflow step, I can do this:
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException { … UserManager userManager = AccessControlUtil.getUserManager(workflowSession.getSession()); Authorizable initiator = userManager.getAuthorizable(workItem.getWorkflow().getInitiator()); … }Note: in a workflow step, if I do ‘workflowSession.getUser()’ I always get ‘admin’ user, and it’s not what I want.
But, as stated in [1] by David McMahon, in an OR step for a workflow, only the workflowData, jcrSession, and workflowSession objects are available to be used within the check() function (not the workItem).
How can I get the initiator user in a workflow route?