mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ETHREEOH-1926 - it is now possible for Consumer users to execute a Copy based Simple Workflow
- use of RunAs to execute the removal of the simpleworkflow aspect which was the only reason Consumer users could not perform the action git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,8 @@ import java.util.Map;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.site.SiteServiceException;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.CopyService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -64,7 +66,7 @@ public class WorkflowUtil
|
||||
*
|
||||
* @throws AlfrescoRuntimeException
|
||||
*/
|
||||
public static void approve(NodeRef ref, NodeService nodeService, CopyService copyService)
|
||||
public static void approve(final NodeRef ref, final NodeService nodeService, final CopyService copyService)
|
||||
throws AlfrescoRuntimeException
|
||||
{
|
||||
Node docNode = new Node(ref);
|
||||
@@ -80,11 +82,11 @@ public class WorkflowUtil
|
||||
Boolean approveMove = (Boolean)props.get(ApplicationModel.PROP_APPROVE_MOVE.toString());
|
||||
NodeRef approveFolder = (NodeRef)props.get(ApplicationModel.PROP_APPROVE_FOLDER.toString());
|
||||
|
||||
// first we need to take off the simpleworkflow aspect
|
||||
nodeService.removeAspect(ref, ApplicationModel.ASPECT_SIMPLE_WORKFLOW);
|
||||
|
||||
if (approveMove.booleanValue())
|
||||
{
|
||||
// first we need to take off the simpleworkflow aspect
|
||||
nodeService.removeAspect(ref, ApplicationModel.ASPECT_SIMPLE_WORKFLOW);
|
||||
|
||||
// move the node to the specified folder
|
||||
String qname = QName.createValidLocalName(docNode.getName());
|
||||
nodeService.moveNode(ref, approveFolder, ContentModel.ASSOC_CONTAINS,
|
||||
@@ -92,6 +94,17 @@ public class WorkflowUtil
|
||||
}
|
||||
else
|
||||
{
|
||||
// first we need to take off the simpleworkflow aspect
|
||||
// NOTE: run as system to allow Consumers to copy an item
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
{
|
||||
public String doWork() throws Exception
|
||||
{
|
||||
nodeService.removeAspect(ref, ApplicationModel.ASPECT_SIMPLE_WORKFLOW);
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
// copy the node to the specified folder
|
||||
String name = docNode.getName();
|
||||
String qname = QName.createValidLocalName(name);
|
||||
|
Reference in New Issue
Block a user