cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced workflow on an 'invisible' space

jenn_l
Champ on-the-rise
Champ on-the-rise
Hi all,

I have a situation here where I want to start a workflow on a document, which is placed in a space where other people don't have access (not even consumer permission). When the advanced workflow is started, the reviewer can see the task, but can't see the document (resources), which is not what I want.
But these documents need to be secured in a space, which is not visible for others, because not everybody may see the documents. Only certain people may review (see) particular documents in this space.

How can I accomplish this?  The document must be seen by only the selected reviewers in the workflow.
Please help…

Regards,
Jenny
6 REPLIES 6

jayjayecl
Confirmed Champ
Confirmed Champ
Hi,

use script or java actions after the start-task to create custom permissions suiting your needs.
See http://wiki.alfresco.com/wiki/WorkflowAdministration to know how to call script or java actions in a workflow process definition.
See http://wiki.alfresco.com/wiki/3.1_JavaScript_API#Permission_and_Security_API to know about permissions scripting API, or http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/repo/security/permissions/impl/Pe... to know about permissions JAVA API.

hope this helps

jenn_l
Champ on-the-rise
Champ on-the-rise
Hi,

Thanks for your quick reply.

I am using an enterprise edition of Alfresco. How do I create my own xml with a jboss designer?
Can you be a little more specific, please? Does that mean that I can create by hand my own xml file and give the selected people other permission when this customized workflow is started?

Regards,
Jenny

jayjayecl
Confirmed Champ
Confirmed Champ
Can you be a little more specific, please? Does that mean that I can create by hand my own xml file and give the selected people other permission when this customized workflow is started?

Yes, and as workflows are quite complex, I would need about three days to write a complete explanation about what I said.
I think the best thing to do for you is have a look at this perfect tutorial :
http://ecmarchitect.com/archives/2007/11/19/785

jenn_l
Champ on-the-rise
Champ on-the-rise
Okay, I understand.
I'll check on it and do my best.
Thanks again.

jenn_l
Champ on-the-rise
Champ on-the-rise
Hi all,

I am overwriting the permission for a reviewer and after the workflow is ended, all the permission will be removed from the reviewer. This works fine for the workflows that I've modified.
I'm still not able to do the above, when the reviewer choose for a reassign.
Here I have an example of my adhoc_processdefintion.xml , which is OK.

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

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

   <swimlane name="initiator"/>

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

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>
  
   <task-node name="adhoc">
      <task name="wf:adhocTask" swimlane="assignee">
         <event type="task-create">
            <script>
               if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
               if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
            </script>
         </event>
      </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++)
                    {
                        var username = bpm_assignee.properties["cm:userName"];
                  if (logger.isLoggingEnabled()) logger.log("Setting permission Coordinator for " + username);
                  var document = bpm_package.children[i];
                  var parent = bpm_package.children[i].getParent();
                  /* Make it visible. */
                  document.setPermission("Coordinator",username);
                  /* Enable check-out/check-in. */
                  parent.setPermission("Coordinator",username);
               }
                </script>
            </action>
        </event>
      <transition name="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (wf_notifyMe)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done";
                 mail.execute(bpm_package);
              }
              for (var i = 0; i &lt; bpm_package.children.length; i++)
                    {
                       var username = bpm_assignee.properties["cm:userName"];
                  if (logger.isLoggingEnabled()) logger.log("Removing permission Coordinator for " + username);
                  var document = bpm_package.children[i];
                  var parent = bpm_package.children[i].getParent();
                  /* Hide it. */
                  document.removePermission("Coordinator",username);
                  /* Disable check-out/check-in*/
                  parent.removePermission("Coordinator",username);
               }
           </script>
         </action>
        </transition>
   </task-node>
  
   <task-node name="completed">
      <task name="wf:completedAdhocTask" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>
     
   <end-state name="end"/>
  
</process-definition>


The following code of mine changerequest_processdefinition.xml doesn't work:


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

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

   <swimlane name="initiator" />

   <start-state name="start">
      <task name="wcmwf:submitChangeRequestTask" swimlane="initiator" />
      <transition name="" to="changeRequest" />
   </start-state>

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>
  
   <task-node name="changeRequest">
      <task name="wcmwf:changeRequestTask" swimlane="assignee" >
     <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{bpm_assignee}</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++)
                    {
                        var username = bpm_assignee.properties["cm:userName"];
                  if (logger.isLoggingEnabled()) logger.log("Setting permission Coordinator for " + username);
                  var document = bpm_package.children[i];
                  var parent = bpm_package.children[i].getParent();
                  /* Make it visible. */
                  document.setPermission("Coordinator",username);
                  /* Enable check-out/check-in. */
                  parent.setPermission("Coordinator",username);
               }
                </script>
            </action>
        </event>
      <transition name="" to="end" >
     <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                     for (var i = 0; i &lt; bpm_package.children.length; i++)
                    {
                       var username = bpm_assignee.properties["cm:userName"];

                  if (logger.isLoggingEnabled()) logger.log("Removing permission Coordinator for " + username);
                  var document = bpm_package.children[i];
                  var parent = bpm_package.children[i].getParent();
                  /* Hide it. */
                  document.removePermission("Coordinator",username);
                  /* Disable check-out/check-in*/
                  parent.removePermission("Coordinator",username);
               }
                </script>
            </action>
    
     </transition>
   </task-node>
     
   <end-state name="end" />
  
   <event type="process-end">
        <action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
    </event>
  
</process-definition>

Anyone, any help about what I am missing?

Thanks,

sgartner
Champ on-the-rise
Champ on-the-rise
The following code of mine changerequest_processdefinition.xml doesn't work:
Jenn_l,

If you were able to get this working consistently in your own custom workflow, I would love to see the final solution.

Thanks,