mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
CLOUD-1927, CLOUD-1929: Merged PATCHES/V4.1.5 to HEAD:
51932: Merged DEV to PATCHES/V4.1.5 (4.1.5) 51931: MNT-9145 : "Review" link for assigned to User task is absent in Parallel Review and Approve (Activiti) - Allow user from same parallel review workflow to see tasks assigned to other users. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@53834 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -59,7 +59,7 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
|||||||
{
|
{
|
||||||
Object result = invocation.proceed();
|
Object result = invocation.proceed();
|
||||||
WorkflowTask wt = (WorkflowTask) result;
|
WorkflowTask wt = (WorkflowTask) result;
|
||||||
if (isInitiatorOrAssignee(wt, currentUser))
|
if (isInitiatorOrAssignee(wt, currentUser) || fromSameParallelReviewWorkflow(wt, currentUser))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,8 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (methodName.equals("getAssignedTasks") || methodName.equals("getPooledTasks") || methodName.equals("getTasksForWorkflowPath") || methodName.equals("getStartTasks") || methodName.equals("queryTasks"))
|
// Not including getAssignedTasks and getPooledTasks, as the methods themselves already take into account the authenticated user/group
|
||||||
|
if (methodName.equals("getTasksForWorkflowPath") || methodName.equals("getStartTasks") || methodName.equals("queryTasks"))
|
||||||
{
|
{
|
||||||
Object result = invocation.proceed();
|
Object result = invocation.proceed();
|
||||||
List<WorkflowTask> rawList = (List<WorkflowTask>) result;
|
List<WorkflowTask> rawList = (List<WorkflowTask>) result;
|
||||||
@@ -94,7 +95,7 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
|||||||
|
|
||||||
for (WorkflowTask wt : rawList)
|
for (WorkflowTask wt : rawList)
|
||||||
{
|
{
|
||||||
if (isInitiatorOrAssignee(wt, currentUser))
|
if (isInitiatorOrAssignee(wt, currentUser) || fromSameParallelReviewWorkflow(wt, currentUser))
|
||||||
{
|
{
|
||||||
resultList.add(wt);
|
resultList.add(wt);
|
||||||
}
|
}
|
||||||
@@ -148,6 +149,29 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean fromSameParallelReviewWorkflow(WorkflowTask wt, String userName)
|
||||||
|
{
|
||||||
|
// check whether this is parallel review workflow, "parallel" will match all jbpm and activity parallel workflows
|
||||||
|
if (wt.getPath().getInstance().getDefinition().getName().toLowerCase().contains("parallel"))
|
||||||
|
{
|
||||||
|
WorkflowTaskQuery tasksQuery = new WorkflowTaskQuery();
|
||||||
|
tasksQuery.setTaskState(null);
|
||||||
|
tasksQuery.setActive(null);
|
||||||
|
tasksQuery.setProcessId(wt.getPath().getInstance().getId());
|
||||||
|
List<WorkflowTask> allWorkflowTasks = workflowService.queryTasks(tasksQuery, true);
|
||||||
|
|
||||||
|
for (WorkflowTask task : allWorkflowTasks)
|
||||||
|
{
|
||||||
|
if (isInitiatorOrAssignee(task, userName))
|
||||||
|
{
|
||||||
|
// if at list one match then user has task from the same workflow
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private NodeRef getUserGroupRef(Object o)
|
private NodeRef getUserGroupRef(Object o)
|
||||||
{
|
{
|
||||||
NodeRef result = null;
|
NodeRef result = null;
|
||||||
|
Reference in New Issue
Block a user