我正在尝试将我的Alfresco Activiti工作流程中的“发起人”重新分配给“管理员”,以防止原始发起人修改工作流程。这是有效的,除了工作流程只出现在原始启动器的“我已经开始的工作流程”下拉列表中。它没有出现在“管理员”“我开始的工作流程”中。有谁知道我需要改变什么来实际完全改变这个新人的工作流程?
@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());
}
答案 0 :(得分:0)
这里的方法是重写WorkflowPermissionInterceptor,特别是WorkflowPermissionInterceptor#isInitiatorOrAssignee()。对于不应允许发起者访问的调用方法,此方法应返回false。
如果这是一个企业项目,您需要从Alfresco支持中注销此类更改,否则您将面临将实施置于不受支持状态的风险。
这个答案解决了你的问题,但它解决了你的问题。通过更改重写拦截器,可以防止启动器修改工作流任务(除非他们是管理员用户或受让人)。