ALF-16472: System-user is NOT attempted to be turned into initiator (and initiator_home) nodeRefs for building up task-listener context, no System cm:person nodeRef exists

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@43209 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Frederik Heremans
2012-10-29 15:12:50 +00:00
parent 8fd64e42ec
commit 2cb4640004

View File

@@ -32,6 +32,7 @@ import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.ScriptService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.workflow.WorkflowException;
/**
@@ -167,12 +168,14 @@ public class ActivitiScriptBase
{
userName = AuthenticationUtil.getFullyAuthenticatedUser();
}
if (userName != null)
// The "System" user is a special case, which has no person object associated with it.
if(userName != null && !AuthenticationUtil.SYSTEM_USER_NAME.equals(userName))
{
ServiceRegistry services = getServiceRegistry();
NodeRef person = services.getPersonService().getPerson(userName);
if(person !=null)
PersonService personService = services.getPersonService();
if (personService.personExists(userName))
{
NodeRef person = personService.getPerson(userName);
return new ActivitiScriptNode(person, services);
}
}