AnsweredAssumed Answered

permissions in parallel workflow

Question asked by giorgio on Oct 1, 2009
What is the problem in the following code in my parallelreview_processdefinition.xml? I am telling you what happens with this code I do is go through the attachment that has the workflow and each document will break the permission inheritance and we'll remove consumer assign permissions to users of workflow, then ask if is sending me an email to each user, because permissions are assigned only to the first user? ie can only see the attached the first user to assign the workflow, but others can not see. May be due to this? however the task and reach all the mail too.

greetings and thanks in advance.

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:parallelreview">

    <swimlane name="initiator"></swimlane>

    <start-state name="start">
        <task name="wf:submitParallelReviewTask" swimlane="initiator"/>
        <transition name="" to="startreview"/>
    </start-state>

    <node name="startreview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{bpm_assignees}</foreach>
            <var>reviewer</var>
        </action>

        <event type="node-enter">
            <script>
                <variable name="wf_approveCount" access="write" />
                <expression>
                    wf_approveCount = 0;
                </expression>
            </script>
        </event>
        <transition name="review" to="review" />
    </node>

    <task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
        </task>
<event type="node-enter">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>


for (var i = 0; i &lt; bpm_package.children.length; i++)
{

bpm_package.children[i].setInheritsPermissions(false);

var permissions = bpm_package.children[i].permissions;
var acl=[];
for (var j=0; j &lt; permissions.length; j++)
{
acl = permissions[j].split(";");
var perm=acl[2];
var grp=acl[1];
bpm_package.children[i].removePermission(perm,grp);

}

bpm_package.children[i].setPermission("Consumer", reviewer.properties["cm:userName"]);

}


           var mail = actions.create("mail");
           mail.parameters.to = "correo@correo.es";
           mail.parameters.subject = "Notificacion de tarea asignada";
           mail.parameters.from = "noreply@notasinternas.edu.gva.es";
           mail.parameters.text = reviewer.properties["cm:userName"]+"No responda a este mensaje.Tiene una tarea ASIGNADA debe revisarla aqui http://notasinternas.edu.gva.es";
           mail.execute(bpm_package);

</script>
</action>
</event>
        <transition name="reject" to="endreview" />
        <transition name="approve" to="endreview">
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
            </script>
        </transition>
    </task-node>

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <event type="node-enter">
           <script>
              <variable name="wf_reviewerCount" access="write"/>
              <variable name="wf_requiredPercent" access="write"/>
              <variable name="wf_actualPercent" access="write"/>
              <expression>
                  wf_requiredPercent = wf_requiredApprovePercent;
                  wf_reviewerCount = bpm_assignees.size();
                  wf_actualPercent = ((wf_approveCount * 100) / wf_reviewerCount);
              </expression>
           </script>
        </event>
        <transition name="reject" to="rejected" />
        <transition name="approve" to="approved">
            <condition>#{wf_actualPercent >= wf_requiredApprovePercent}</condition>
        </transition>
    </decision>
              
    <task-node name="rejected">
        <transition to="end" />
    </task-node>

    <task-node name="approved">
        <transition to="end" />
    </task-node>

    <end-state name="end"/>

</process-definition>

Outcomes