mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.3) to HEAD (5.1/Cloud)
108605: MNT-14413: Merged 5.0.1 (5.0.1.4) to 5.0.N (5.0.3) 108254: MNT-14366 : Re-created user does not have access to his existing workflows - get owner property from initiatorhome nodeRef if initiator nodeRef no longer exists, 108318: MNT-14366 : Re-created user does not have access to his existing workflows - fix for failed tests, 108467: MNT-14366 : Re-created user does not have access to his existing workflows - test to check functionality is working git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@108616 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,9 +29,11 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.repo.workflow.WorkflowConstants;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -43,6 +45,7 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
||||
private PersonService personService;
|
||||
private AuthorityService authorityService;
|
||||
private WorkflowService workflowService;
|
||||
private NodeService nodeService;
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable
|
||||
@@ -137,6 +140,16 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
||||
Map<QName, Serializable> props = wt.getProperties();
|
||||
|
||||
String ownerName = (String) props.get(ContentModel.PROP_OWNER);
|
||||
//fix for MNT-14366; if owner value can't be found on workflow properties because initiator nodeRef no longer exists
|
||||
//get owner from initiatorhome nodeRef owner property
|
||||
if (ownerName == null)
|
||||
{
|
||||
NodeRef initiatorHomeNodeRef = (NodeRef)props.get( QName.createQName("", WorkflowConstants.PROP_INITIATOR_HOME));
|
||||
if (initiatorHomeNodeRef != null )
|
||||
{
|
||||
ownerName = (String)nodeService.getProperty(initiatorHomeNodeRef, ContentModel.PROP_OWNER);
|
||||
}
|
||||
}
|
||||
if (userName != null && userName.equalsIgnoreCase(ownerName))
|
||||
{
|
||||
return true;
|
||||
@@ -274,4 +287,9 @@ public class WorkflowPermissionInterceptor implements MethodInterceptor
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user