RM-3216 - added unit test

This commit is contained in:
Ana Bozianu
2016-04-08 14:46:14 +03:00
parent 6935c5ea36
commit a48e690ad3
3 changed files with 111 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ package org.alfresco.repo.imap;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -46,7 +46,8 @@ public class ExtendedImapServiceImpl extends ImapServiceImpl
{
private NodeService nodeService;
private BehaviourFilter policyBehaviourFilter;
private DictionaryService dictionaryService;
private DictionaryService dictionaryService;
private AuthenticationUtil authenticationUtil;
public void setDictionaryService(DictionaryService dictionaryService)
{
@@ -64,12 +65,12 @@ public class ExtendedImapServiceImpl extends ImapServiceImpl
this.nodeService = nodeService;
super.setNodeService(nodeService);
}
@Override
/**
* Overwrites the core functionality so we can list RM files in IMAP
* @see https://issues.alfresco.com/jira/browse/RM-3216
*/
*/
@Override
public String getPathFromSites(final NodeRef ref)
{
return doAsSystem(new RunAsWork<String>()
@@ -97,7 +98,7 @@ public class ExtendedImapServiceImpl extends ImapServiceImpl
policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
try
{
return AuthenticationUtil.runAs(work, AuthenticationUtil.getSystemUserName());
return authenticationUtil.runAsSystem(work);
}
finally
{