We have a multi site setup with separate content trees with their own groups and users. The 4-eye principle is strictly enforced, so no user has replication rights.
The limitation of CQ is that if a user with no replication rights clicks on the activate button in SiteAdmin or the Sidekick, the Default Request for Activation workflow gets triggered. This is hardcoded and cannot be changed; the same is valid for deactivation. So what I did is to create a custom workflow step which I placed as the only step into the default workflows. This custom step checks the path of the workload item and triggers the correct workflow for this tree.
First problem: As this step is directly completed and a new workflow is triggered, the user that started the workflow, immediatly gets the message that the workflow is completed. Can I somehow have the second workflow be a subtask so the initial workflow only gets completed when the subtask is completed?
Second problem: The tree specific workflow has one approver step, followed by a custom 4-eye-check step (if the last modified user equals the approver, the workflow steps back to the approver step with an error) and the last step is the com.day.cq.wcm.workflow.process.ActivatePageProcess
. But as no user has replication rights the checkbox "Replicate As Participant" is not selected. Thus each page has admin
as the cq:lastReplicatedBy
. Is it somehow possible to have the approver set without him having replicaton rights?
Code Snippet of our forking workflow:
protected void processItem(WorkItem item, WorkflowSession wfSession, WorkflowData workflowData, String config) throws WorkflowException {
ResourceResolver resolver = getResourceResolver();
PageManager pm = resolver.adaptTo(PageManager.class);
try {
String path = workflowData.getPayload().toString();
Page page = pm.getContainingPage(path);
if (page != null) {
//calculate the id of the correct model depending on page
String wfid = getWfId(page);
WorkflowModel mmodel = wfSession.getModel(wfId);
wfSession.startWorkflow(model, workflowData);
}
} finally {
closeResourceResolver(resolver);
wfSession.terminateWorkflow(item.getWorkflow());
}
}
ps. This is a combined question regarding our special workflow setup. If some moderator thinks I should ask two seperate questions, please let me know.