AnsweredAssumed Answered

Permissions For Content in Workflow

Question asked by vinaxwater on Dec 30, 2008
Latest reply on Aug 24, 2010 by sebp
I have a workflow want set permission for contents in start this workflow. I config default permission for owner of content is "Coordinator" when i start this workflow this permission will removed and add permission "Consumer" (The mean: not Edit this content when workflow started with this content) for this content but i have message error: " Access Denied ". Help me ! Thanks.

This is branch when start workflow (in file process) :

<swimlane name="initiator"></swimlane>
   
   <start-state name="start">
      <task name="wf:startOfficialTask" swimlane="initiator"></task>
      <transition to="nodeSubmit" name="startLegal/Official">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="bpm_groupAssignees" access="read" />
                    <expression>if(bpm_groupAssignees == null) alert("groupAssignees is NULL");</expression>
              </script>
           </action>
      </transition>
   </start-state>

   <node name="nodeSubmit">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
           <foreach>#{people.getMembers(bpm_groupAssignees)}</foreach>
            <var>user</var>
        </action>
        <event type="node-enter">
            <script>
                <expression>
                   wf_countAssignees = 0;
               wf_sizeAssignees = bpm_NTISgroupAssignees.size();               
                    if (bpm_workflowDueDate != void) { wf_dueDate = bpm_workflowDueDate; }
                    if (bpm_workflowPriority.equals("Urgent")) { wf_priority = 1; }
               if (bpm_workflowPriority.equals("Intermediate")) { wf_priority = 2; }
               if (bpm_workflowPriority.equals("Normal")) { wf_priority = 3; }
                </expression>
            <variable name="wf_dueDate" access="write" />
                <variable name="wf_priority" access="write" />
                <variable name="wf_countAssignees" access="write" />
                <variable name="wf_sizeAssignees" access="write" />              
            </script>
        </event>
      <transition to="TF">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>                
                 for (var i = 0; i &lt; bpm_package.children.length; i++)
                     {
                       var resource = bpm_package.children[i];
                       resource.setPermission("Coordinator", user.properties.userName);
                       resource.setOwner("admin");
                                resource.setPermission("Consumer", initiator.properties.userName);                       
                                resource.removePermission("Coordinator", initiator.properties.userName);                       
                        }
              </script>
            </action>
      </transition>
   </node>

   <decision name="TF">
       <event type="node-enter">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
          <script>
              if(wf_Official == "Select Option"){
                alert("Please choose Legal/Official");
              }
          </script>
          </action>
           </event>
      <transition to="CRMView" name="isLegal">
         <condition>#{wf_Official == "Legal"}</condition>
      </transition>
      <transition to="OFFView" name="isOff">
         <condition>#{wf_Official == "Official"}</condition>
      </transition>
   </decision>

   <task-node name="CRMView">      
      <task name="wf:officialCRMTask">
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
              <pooledactorsNTIS>#{user}</pooledactorsNTIS>
           </assignment>
           <event type="task-create">
              <script>
                 <variable name="wf_dueDate" access="read,write" />
                   <variable name="wf_priority" access="read,write" />
                   <variable name="bpm_groupAssignees" access="read,write" />
                   <expression>
                      taskInstance.dueDate = wf_dueDate;
                  taskInstance.priority = wf_priority;
                  bpm_groupAssignees = null;
                   </expression>
                </script>
         </event>
      </task>
      <transition to="nodeCRM" name="Continue"></transition>
   </task-node>

Regards.

Outcomes