I am interested in setting permissions in workflow dynamically. Say, you started a workflow on a resource "A". And a user "U" does not have permission to read "A". But if a task is assigned to the user "U", I would like to make the resource "A" readable to the user "U" while the user "U" doing his task.
Look at the "Permission and Security API" on the JavaScript API wiki page. That will allow you to run a piece of JavaScript that adds the user with read access to the document. Because JavaScript running in a workflow runs with the user's permission by default, you will need to use "runas" to run this script as the system user.
If you need to know how to add JavaScript to a workflow, you might take a look at the advanced workflow tutorial. The first edition covers jBPM and the second edition covers Activiti.
Did you solve this problem? I have the same problem and I am a beginner so I have no idea how to do this. I just started with workflows and am still bit confused so if possible please share your solution . Thanks in advance Irena