10-01-2009 07:16 AM
<?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 < 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 < 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>
10-01-2009 12:11 PM
document.setInheritsPermissions(false);
document.save();
var permissions = document.permissions;
var acl=[];
for (var j=0; j < permissions.length; j++)
{
acl = permissions[j].split(";");
var perm=acl[2];
var grp=acl[1];
document.removePermission(perm,grp);
document.save();
}
document.setPermission("Coordinator", "user1");
document.save();
document.setPermission("Coordinator", "user2");
document.save();
var mail = actions.create("mail");
mail.parameters.to="jherraiz986g@cv.gva.es";
mail.parameters.subject = "Permisos";
mail.parameters.from = "noreply@notasinternas.edu.gva.es";
mail.parameters.text = permissions+"hola hola hola permisos añadidos –> "+document.permissions;
var doc=companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email.ftl");
mail.execute(doc);
10-02-2009 02:20 AM
10-02-2009 02:31 AM
10-02-2009 02:39 AM
10-02-2009 02:43 AM
10-02-2009 02:49 AM
10-02-2009 05:00 AM
<event type="node-enter">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < 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 < 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>
for (var j=0; j < permissions.length; j++)
{
acl = permissions[j].split(";");
var perm=acl[2];
var grp=acl[1];
bpm_package.children[i].removePermission(perm,grp);
}
con este for los permisos del documento se estan recorriendo y se le estan quitando. ¿que ocurria entonces?bpm_package.children[i].setPermission("Editor", bpm_assignee.properties["cm:userName"]);
bpm_package.children[i].save();
10-02-2009 08:16 AM
bpm_package.children[z].removePermission("Coordinator", reviewer.properties["cm:userName"]);Ya no falla, por lo que deduzco que donde da acces denied, es en esta instrucción,
bpm_package.children[z].save();
10-02-2009 08:36 AM
10-05-2009 03:13 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.