Reassigning "initiator" in Alfresco Activiti workflow -
i trying re-assign "initiator" in alfresco activiti workflow "admin" prevent original initiator modifying workflow. working except workflow appears in original initiator's "workflows i've started" dropdown. doesn't appear in "admins'" "workflows i've started". know need change change workflow new person?
@override public void notify(final delegateexecution execution) { authenticationutil.runas(new authenticationutil.runaswork<object>() { @override public object dowork() throws exception { system.out.println("in setinitiatorlistener"); activitiscriptnode initiatorscriptnode = (activitiscriptnode) execution.getvariable("initiator"); execution.setvariable(utilmodel.workflow_finance_original_initiator_script_node, initiatorscriptnode); execution.setvariable(utilmodel.workflow_finance_original_initiator_username, initiatorscriptnode.getproperties().get("username")); noderef initiatornoderef = initiatorscriptnode.getnoderef(); if (workflowtype.getexpressiontext().equals("pcardis")) { execution.setvariable(utilmodel.workflow_finance_pcard_original_initiator_node, initiatornoderef); } else { execution.setvariable(utilmodel.workflow_finance_journal_voucher_original_initiator_node, initiatornoderef); } string path = templatepath.getexpressiontext(); system.out.println("path:" + path); properties ownermappings = templateutil.loadtemplates(path); string ownerstring = ownermappings.getproperty(workflowtype.getexpressiontext()); // pcardis? if (ownerstring == null) { // try catagory string category = (string) execution.getvariable(utilmodel.workflow_finance_journal_voucher_category); system.out.println("category:" + category); if (category != null) { ownerstring = ownermappings.getproperty(category); } } if (ownerstring == null) { // else default ownerstring = ownermappings.getproperty("default"); } noderef newinitiatornoderef = personservice.getperson(ownerstring); activitiscriptnode asn = new activitiscriptnode(newinitiatornoderef, serviceregistry); execution.setvariable("initiator", asn); execution.setvariable("initiatorhome", asn); //execution.setvariable("originalinitiatorscriptnode", asn); return null; } }, authenticationutil.getadminusername()); }
an approach here rewrite workflowpermissioninterceptor, workflowpermissioninterceptor#isinitiatororassignee(). method should return false invoked methods initiator should not allowed access.
if enterprise project, need type of change signed off alfresco support, otherwise run risk of putting implementation in unsupported state.
this answer address question, addresses problem. changing rewriting interceptor, can prevent initiator being able modify workflow tasks (unless admin user or assignee).
Comments
Post a Comment