mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
REPO-4132: User 'System' cleanup follow-up (Revert changes in REPO-3743) (#330)
* Reverted changes for REPO-3743 #276 * Changes in PersonService to ensure a consistent behaviour for the System case: - PersonService.createPerson() throws now an AlfrescoRuntimeException when trying to create a person for the username 'System' - PersonService.getPerson("System") throws NoSuchPersonException - PersonService.personExists("System") returns false * Remove StandardRenditionLocationResolverTest tests from the suite - the RenditionService deprecated, so related tests won't be maintained * Fixes for the System user case in ImapService * Update alfresco-data-model 8.27
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -38,7 +38,7 @@
|
|||||||
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
|
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
|
||||||
<dependency.alfresco-core.version>7.9</dependency.alfresco-core.version>
|
<dependency.alfresco-core.version>7.9</dependency.alfresco-core.version>
|
||||||
<dependency.alfresco-greenmail.version>6.1</dependency.alfresco-greenmail.version>
|
<dependency.alfresco-greenmail.version>6.1</dependency.alfresco-greenmail.version>
|
||||||
<dependency.alfresco-data-model.version>8.26</dependency.alfresco-data-model.version>
|
<dependency.alfresco-data-model.version>8.27</dependency.alfresco-data-model.version>
|
||||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||||
<dependency.alfresco-pdf-renderer.version>1.1</dependency.alfresco-pdf-renderer.version>
|
<dependency.alfresco-pdf-renderer.version>1.1</dependency.alfresco-pdf-renderer.version>
|
||||||
<dependency.alfresco-hb-data-sender.version>1.0.9</dependency.alfresco-hb-data-sender.version>
|
<dependency.alfresco-hb-data-sender.version>1.0.9</dependency.alfresco-hb-data-sender.version>
|
||||||
|
@@ -667,7 +667,7 @@ public class ContentDiskDriver extends AlfrescoTxDiskDriver implements DiskInter
|
|||||||
// Use the system user as the authenticated context for the filesystem initialization
|
// Use the system user as the authenticated context for the filesystem initialization
|
||||||
|
|
||||||
AuthenticationUtil.pushAuthentication();
|
AuthenticationUtil.pushAuthentication();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Start the transaction
|
// Start the transaction
|
||||||
|
|
||||||
|
@@ -264,7 +264,7 @@ public class SiteLoadPatch extends AbstractPatch
|
|||||||
);
|
);
|
||||||
|
|
||||||
// At this point we can go back to being the system
|
// At this point we can go back to being the system
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Setup the Importer Bootstrap Beans
|
// Setup the Importer Bootstrap Beans
|
||||||
for(ImporterBootstrap bootstrap : new ImporterBootstrap[] { spacesBootstrap, usersBootstrap })
|
for(ImporterBootstrap bootstrap : new ImporterBootstrap[] { spacesBootstrap, usersBootstrap })
|
||||||
|
@@ -98,6 +98,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
|||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
@@ -470,7 +471,7 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
|||||||
for (String mountPointName : imapConfigMountPoints.keySet())
|
for (String mountPointName : imapConfigMountPoints.keySet())
|
||||||
{
|
{
|
||||||
result.addAll(listMailboxes(new AlfrescoImapUser(null, AuthenticationUtil
|
result.addAll(listMailboxes(new AlfrescoImapUser(null, AuthenticationUtil
|
||||||
.getAdminUserName(), null), mountPointName + "*", false));
|
.getSystemUserName(), null), mountPointName + "*", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -1388,11 +1389,21 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
|||||||
{
|
{
|
||||||
Set<NodeRef> result = new HashSet<NodeRef>();
|
Set<NodeRef> result = new HashSet<NodeRef>();
|
||||||
PersonService personService = serviceRegistry.getPersonService();
|
PersonService personService = serviceRegistry.getPersonService();
|
||||||
NodeRef userRef = personService.getPerson(userName);
|
|
||||||
List<AssociationRef> unsubscribedFodlers = nodeService.getTargetAssocs(userRef, ImapModel.ASSOC_IMAP_UNSUBSCRIBED);
|
NodeRef userRef = null;
|
||||||
for (AssociationRef asocRef : unsubscribedFodlers)
|
|
||||||
|
if (personService.personExists(userName))
|
||||||
{
|
{
|
||||||
result.add(asocRef.getTargetRef());
|
userRef = personService.getPerson(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userRef != null)
|
||||||
|
{
|
||||||
|
List<AssociationRef> unsubscribedFodlers = nodeService.getTargetAssocs(userRef, ImapModel.ASSOC_IMAP_UNSUBSCRIBED);
|
||||||
|
for (AssociationRef asocRef : unsubscribedFodlers)
|
||||||
|
{
|
||||||
|
result.add(asocRef.getTargetRef());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -1412,6 +1423,8 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
|||||||
*/
|
*/
|
||||||
private List<NodeRef> getFavouriteSites(final String userName)
|
private List<NodeRef> getFavouriteSites(final String userName)
|
||||||
{
|
{
|
||||||
|
PersonService personService = serviceRegistry.getPersonService();
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("[getFavouriteSites] entry for user: " + userName);
|
logger.debug("[getFavouriteSites] entry for user: " + userName);
|
||||||
@@ -1432,47 +1445,48 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
|||||||
{
|
{
|
||||||
favSites = new LinkedList<NodeRef>();
|
favSites = new LinkedList<NodeRef>();
|
||||||
|
|
||||||
PreferenceService preferenceService = (PreferenceService) serviceRegistry
|
if (personService.personExists(userName))
|
||||||
.getService(ServiceRegistry.PREFERENCE_SERVICE);
|
|
||||||
Map<String, Serializable> prefs = preferenceService.getPreferences(
|
|
||||||
userName, AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES);
|
|
||||||
|
|
||||||
for (String key : prefs.keySet())
|
|
||||||
{
|
{
|
||||||
Boolean isImapFavourite = (Boolean) prefs.get(key);
|
PreferenceService preferenceService = (PreferenceService) serviceRegistry.getService(ServiceRegistry.PREFERENCE_SERVICE);
|
||||||
if (isImapFavourite != null && isImapFavourite)
|
Map<String, Serializable> prefs = preferenceService.getPreferences(userName, AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES);
|
||||||
{
|
|
||||||
String siteName = key.substring(AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES.length() + 1); // count the dot
|
|
||||||
boolean isMember = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
isMember = serviceRegistry.getSiteService().isMember(siteName, userName);
|
|
||||||
}
|
|
||||||
catch (SiteDoesNotExistException sdne)
|
|
||||||
{
|
|
||||||
// Ignore, see MNT-13579
|
|
||||||
// The site might be archived. In this case it will still be in user's preferences.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMember)
|
for (String key : prefs.keySet())
|
||||||
|
{
|
||||||
|
Boolean isImapFavourite = (Boolean) prefs.get(key);
|
||||||
|
if (isImapFavourite != null && isImapFavourite)
|
||||||
{
|
{
|
||||||
SiteInfo siteInfo = serviceRegistry.getSiteService().getSite(siteName);
|
String siteName = key.substring(AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES.length() + 1); // count the dot
|
||||||
if (siteInfo != null)
|
boolean isMember = false;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if(logger.isDebugEnabled())
|
isMember = serviceRegistry.getSiteService().isMember(siteName, userName);
|
||||||
|
}
|
||||||
|
catch (SiteDoesNotExistException sdne)
|
||||||
|
{
|
||||||
|
// Ignore, see MNT-13579
|
||||||
|
// The site might be archived. In this case it will still be in user's preferences.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMember)
|
||||||
|
{
|
||||||
|
SiteInfo siteInfo = serviceRegistry.getSiteService().getSite(siteName);
|
||||||
|
if (siteInfo != null)
|
||||||
{
|
{
|
||||||
logger.debug("[getFavouriteSites] User: " + userName + " Favourite site: " + siteInfo.getShortName());
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("[getFavouriteSites] User: " + userName + " Favourite site: " + siteInfo.getShortName());
|
||||||
|
}
|
||||||
|
favSites.add(siteInfo.getNodeRef());
|
||||||
}
|
}
|
||||||
favSites.add(siteInfo.getNodeRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("[getFavouriteSites] Bind new Favorite sites' list to transaction " + AlfrescoTransactionSupport.getTransactionId());
|
||||||
|
}
|
||||||
|
AlfrescoTransactionSupport.bindResource(FAVORITE_SITES, favSites);
|
||||||
}
|
}
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("[getFavouriteSites] Bind new Favorite sites' list to transaction " + AlfrescoTransactionSupport.getTransactionId());
|
|
||||||
}
|
|
||||||
AlfrescoTransactionSupport.bindResource(FAVORITE_SITES, favSites);
|
|
||||||
}
|
}
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
|
@@ -94,7 +94,7 @@ public class HashPasswordTransactionListener implements TransactionListener
|
|||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
AuthenticationUtil.pushAuthentication();
|
AuthenticationUtil.pushAuthentication();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
|
@@ -493,8 +493,9 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName()))
|
if (isSystemUserName(userName))
|
||||||
{
|
{
|
||||||
|
// The built-in authority SYSTEM is a user, but not a Person (i.e. it does not have a profile).
|
||||||
if (exceptionOrNull)
|
if (exceptionOrNull)
|
||||||
{
|
{
|
||||||
throw new NoSuchPersonException(userName);
|
throw new NoSuchPersonException(userName);
|
||||||
@@ -532,9 +533,9 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
|||||||
*/
|
*/
|
||||||
public boolean personExists(String caseSensitiveUserName)
|
public boolean personExists(String caseSensitiveUserName)
|
||||||
{
|
{
|
||||||
if (isBuiltInAuthorities(caseSensitiveUserName))
|
if (isSystemUserName(caseSensitiveUserName))
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRef person = getPersonOrNullImpl(caseSensitiveUserName);
|
NodeRef person = getPersonOrNullImpl(caseSensitiveUserName);
|
||||||
@@ -546,20 +547,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBuiltInAuthorities(String caseSensitiveUserName)
|
|
||||||
{
|
|
||||||
if (EqualsHelper.nullSafeEquals(caseSensitiveUserName, AuthenticationUtil.getSystemUserName()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (EqualsHelper.nullSafeEquals(caseSensitiveUserName, AuthenticationUtil.getGuestUserName()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private NodeRef getPersonOrNullImpl(String searchUserName)
|
private NodeRef getPersonOrNullImpl(String searchUserName)
|
||||||
{
|
{
|
||||||
Set<NodeRef> allRefs = getFromCache(searchUserName);
|
Set<NodeRef> allRefs = getFromCache(searchUserName);
|
||||||
@@ -993,6 +980,11 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
|||||||
throw new IllegalArgumentException("No username specified when creating the person.");
|
throw new IllegalArgumentException("No username specified when creating the person.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName()))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("The built-in authority '" + AuthenticationUtil.getSystemUserName() + "' is a user, but not a Person (i.e. it does not have a profile).");
|
||||||
|
}
|
||||||
|
|
||||||
AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
|
AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
|
||||||
if (authorityType != AuthorityType.USER)
|
if (authorityType != AuthorityType.USER)
|
||||||
{
|
{
|
||||||
@@ -2190,10 +2182,14 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventPublisher(EventPublisher eventPublisher)
|
public void setEventPublisher(EventPublisher eventPublisher)
|
||||||
{
|
{
|
||||||
this.eventPublisher = eventPublisher;
|
this.eventPublisher = eventPublisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSystemUserName(String userName)
|
||||||
|
{
|
||||||
|
return EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -117,7 +117,7 @@ public class PersonServiceLoader
|
|||||||
|
|
||||||
// check the lazy creation
|
// check the lazy creation
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
final AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
|
final AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
|
||||||
|
@@ -56,7 +56,6 @@ import org.junit.runners.Suite;
|
|||||||
// This test opens, closes and again opens the alfresco application context.
|
// This test opens, closes and again opens the alfresco application context.
|
||||||
org.alfresco.repo.dictionary.CustomModelRepoRestartTest.class,
|
org.alfresco.repo.dictionary.CustomModelRepoRestartTest.class,
|
||||||
|
|
||||||
org.alfresco.repo.rendition.StandardRenditionLocationResolverTest.class,
|
|
||||||
org.alfresco.repo.rendition.executer.HTMLRenderingEngineTest.class,
|
org.alfresco.repo.rendition.executer.HTMLRenderingEngineTest.class,
|
||||||
org.alfresco.repo.rendition.executer.XSLTFunctionsTest.class,
|
org.alfresco.repo.rendition.executer.XSLTFunctionsTest.class,
|
||||||
org.alfresco.repo.rendition.executer.XSLTRenderingEngineTest.class,
|
org.alfresco.repo.rendition.executer.XSLTRenderingEngineTest.class,
|
||||||
|
@@ -811,31 +811,39 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
@Test
|
@Test
|
||||||
public void testActionResult()
|
public void testActionResult()
|
||||||
{
|
{
|
||||||
|
// We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System)
|
||||||
|
// so that we can setup the Person object in the ScriptNode
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Create the script node reference
|
||||||
|
NodeRef script = this.nodeService.createNode(
|
||||||
|
this.folder,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
|
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
|
||||||
|
ContentModel.TYPE_CONTENT).getChildRef();
|
||||||
|
this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
|
||||||
|
ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
|
||||||
|
contentWriter.setMimetype("text/plain");
|
||||||
|
contentWriter.setEncoding("UTF-8");
|
||||||
|
contentWriter.putContent("\"VALUE\";");
|
||||||
|
|
||||||
// Create the script node reference
|
// Create the action
|
||||||
NodeRef script = this.nodeService.createNode(
|
Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
|
||||||
this.folder,
|
action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
|
||||||
ContentModel.ASSOC_CONTAINS,
|
|
||||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
|
|
||||||
ContentModel.TYPE_CONTENT).getChildRef();
|
|
||||||
this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
|
|
||||||
ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
|
|
||||||
contentWriter.setMimetype("text/plain");
|
|
||||||
contentWriter.setEncoding("UTF-8");
|
|
||||||
contentWriter.putContent("\"VALUE\";");
|
|
||||||
|
|
||||||
// Create the action
|
// Execute the action
|
||||||
Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
|
this.actionService.executeAction(action1, this.nodeRef);
|
||||||
action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
|
|
||||||
|
|
||||||
// Execute the action
|
// Get the result
|
||||||
this.actionService.executeAction(action1, this.nodeRef);
|
String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
|
||||||
|
assertNotNull(result);
|
||||||
// Get the result
|
assertEquals("VALUE", result);
|
||||||
String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
|
}
|
||||||
assertNotNull(result);
|
finally
|
||||||
assertEquals("VALUE", result);
|
{
|
||||||
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ===================================================================================
|
/** ===================================================================================
|
||||||
|
@@ -104,9 +104,9 @@ public class SpecialiseTypeActionExecuterTest extends BaseAlfrescoSpringTest
|
|||||||
checkActionAgainAndExpectTypeToChange(action, nodeRef1);
|
checkActionAgainAndExpectTypeToChange(action, nodeRef1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check with "Admin user"
|
// check with "System user"
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Check the type of the node
|
// Check the type of the node
|
||||||
ActionImpl action = checkActionToChangeNodeType(nodeRef2);
|
ActionImpl action = checkActionToChangeNodeType(nodeRef2);
|
||||||
|
@@ -622,7 +622,7 @@ public abstract class AbstractFeedCleanerTest
|
|||||||
|
|
||||||
if (type == 2)
|
if (type == 2)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
int deleteCount = transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Integer>()
|
int deleteCount = transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Integer>()
|
||||||
{
|
{
|
||||||
|
@@ -99,7 +99,7 @@ public class AuditMethodInterceptorTest extends TestCase
|
|||||||
nodeService = serviceRegistry.getNodeService();
|
nodeService = serviceRegistry.getNodeService();
|
||||||
searchService = serviceRegistry.getSearchService();
|
searchService = serviceRegistry.getSearchService();
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
nodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
nodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
|
|
||||||
// Register the models
|
// Register the models
|
||||||
|
@@ -281,7 +281,7 @@ public class AuditableAspectTest extends TestCase
|
|||||||
String modifiedBy = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIER);
|
String modifiedBy = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIER);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The modifier should have changed to reflect the current user",
|
"The modifier should have changed to reflect the current user",
|
||||||
AuthenticationUtil.getFullyAuthenticatedUser(), modifiedBy);
|
AuthenticationUtil.getRunAsUser(), modifiedBy);
|
||||||
|
|
||||||
RetryingTransactionCallback<Void> setAuditableCallback1 = new RetryingTransactionCallback<Void>()
|
RetryingTransactionCallback<Void> setAuditableCallback1 = new RetryingTransactionCallback<Void>()
|
||||||
{
|
{
|
||||||
|
@@ -77,7 +77,7 @@ public class GuessMimetypeTest extends TestCase
|
|||||||
public Object execute() throws Throwable
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
// As system user
|
// As system user
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
|
storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class GuessMimetypeTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
public Object execute() throws Throwable
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13);
|
||||||
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
|
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
|
||||||
@@ -121,7 +121,7 @@ public class GuessMimetypeTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
public Object execute() throws Throwable
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13);
|
||||||
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
|
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
|
||||||
|
@@ -219,7 +219,7 @@ public class ArchiveContentTransformerTest extends AbstractContentTransformerTes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
|
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
|
||||||
assertNotNull(transformer);
|
assertNotNull(transformer);
|
||||||
|
|
||||||
|
@@ -135,7 +135,7 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
|
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
|
||||||
assertNotNull(transformer);
|
assertNotNull(transformer);
|
||||||
|
|
||||||
|
@@ -457,8 +457,8 @@ public class DictionaryModelTypeTest extends BaseSpringTest
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateAndUpdateDictionaryModelNodeContent() throws Exception
|
public void testCreateAndUpdateDictionaryModelNodeContent() throws Exception
|
||||||
{
|
{
|
||||||
// just to make sure we don't regress ACE-5852, some tests should run as Admin
|
// just to make sure we don't regress ACE-5852, some tests should run as System
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Check that the model has not yet been loaded into the dictionary
|
// Check that the model has not yet been loaded into the dictionary
|
||||||
@@ -609,8 +609,8 @@ public class DictionaryModelTypeTest extends BaseSpringTest
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateDictionaryModelPropertyDelete() throws Exception
|
public void testUpdateDictionaryModelPropertyDelete() throws Exception
|
||||||
{
|
{
|
||||||
// just to make sure we don't regress ACE-5852, some tests should run as Admin
|
// just to make sure we don't regress ACE-5852, some tests should run as System
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Check that the model has not yet been loaded into the dictionary
|
// Check that the model has not yet been loaded into the dictionary
|
||||||
@@ -1105,7 +1105,7 @@ public class DictionaryModelTypeTest extends BaseSpringTest
|
|||||||
public void testImportingSameNamespaceFails() throws Exception
|
public void testImportingSameNamespaceFails() throws Exception
|
||||||
{
|
{
|
||||||
// just to make sure we don't regress ACE-5852, some tests should run as System
|
// just to make sure we don't regress ACE-5852, some tests should run as System
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Create model
|
// Create model
|
||||||
final NodeRef modelNode = createActiveModel("dictionary/testModel.xml");
|
final NodeRef modelNode = createActiveModel("dictionary/testModel.xml");
|
||||||
|
@@ -86,7 +86,7 @@ public class FixedAclUpdaterTest extends TestCase
|
|||||||
permissionService = (PermissionService) ctx.getBean("permissionService");
|
permissionService = (PermissionService) ctx.getBean("permissionService");
|
||||||
nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
|
nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
NodeRef home = repository.getCompanyHome();
|
NodeRef home = repository.getCompanyHome();
|
||||||
// create a folder hierarchy for which will change permission inheritance
|
// create a folder hierarchy for which will change permission inheritance
|
||||||
@@ -319,7 +319,7 @@ public class FixedAclUpdaterTest extends TestCase
|
|||||||
final FixedAclUpdater fixedAclUpdater = (FixedAclUpdater) ctx.getBean("fixedAclUpdater");
|
final FixedAclUpdater fixedAclUpdater = (FixedAclUpdater) ctx.getBean("fixedAclUpdater");
|
||||||
final PermissionsDaoComponent permissionsDaoComponent = (PermissionsDaoComponent) ctx.getBean("admPermissionsDaoComponent");
|
final PermissionsDaoComponent permissionsDaoComponent = (PermissionsDaoComponent) ctx.getBean("admPermissionsDaoComponent");
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
NodeRef home = repository.getCompanyHome();
|
NodeRef home = repository.getCompanyHome();
|
||||||
final NodeRef root = createFile(fileFolderService, home, "ROOT", ContentModel.TYPE_FOLDER);
|
final NodeRef root = createFile(fileFolderService, home, "ROOT", ContentModel.TYPE_FOLDER);
|
||||||
|
@@ -154,7 +154,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
|
|||||||
private void setupRepo() throws Exception
|
private void setupRepo() throws Exception
|
||||||
{
|
{
|
||||||
AuthenticationUtil.clearCurrentSecurityContext();
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Create a test workspace
|
// Create a test workspace
|
||||||
this.testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
this.testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
||||||
|
@@ -137,6 +137,7 @@ public class ImapServiceImplTest extends TestCase
|
|||||||
|
|
||||||
private NodeRef testImapFolderNodeRef;
|
private NodeRef testImapFolderNodeRef;
|
||||||
private Flags flags;
|
private Flags flags;
|
||||||
|
private ImapServiceImpl imapServiceImpl;
|
||||||
|
|
||||||
String anotherUserName;
|
String anotherUserName;
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ public class ImapServiceImplTest extends TestCase
|
|||||||
|
|
||||||
ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
|
ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
|
||||||
ApplicationContext imapCtx = imap.getApplicationContext();
|
ApplicationContext imapCtx = imap.getApplicationContext();
|
||||||
ImapServiceImpl imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
|
imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
|
||||||
|
|
||||||
// Creating IMAP test folder for IMAP root
|
// Creating IMAP test folder for IMAP root
|
||||||
LinkedList<String> folders = new LinkedList<String>();
|
LinkedList<String> folders = new LinkedList<String>();
|
||||||
@@ -1006,6 +1007,12 @@ public class ImapServiceImplTest extends TestCase
|
|||||||
assertTrue("New node should have original node aspects", nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE));
|
assertTrue("New node should have original node aspects", nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testListMailboxOnStartup()
|
||||||
|
{
|
||||||
|
authenticationService.clearCurrentSecurityContext();
|
||||||
|
// Starting IMAP
|
||||||
|
imapServiceImpl.startupInTxn(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mailbox - {@link AlfrescoImapFolder} instance which should be checked
|
* @param mailbox - {@link AlfrescoImapFolder} instance which should be checked
|
||||||
|
@@ -84,7 +84,7 @@ public class ImporterComponentTest extends BaseSpringTest
|
|||||||
|
|
||||||
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
|
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
|
||||||
|
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
this.versionService = (VersionService)this.applicationContext.getBean("VersionService");
|
this.versionService = (VersionService)this.applicationContext.getBean("VersionService");
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ public class ImporterComponentTest extends BaseSpringTest
|
|||||||
// Check that the cm:auditable properties are correct
|
// Check that the cm:auditable properties are correct
|
||||||
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-04-30T23:00:00.000Z")), createdDate);
|
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-04-30T23:00:00.000Z")), createdDate);
|
||||||
assertEquals("cm:creator not preserved during import", "Import Creator", creator);
|
assertEquals("cm:creator not preserved during import", "Import Creator", creator);
|
||||||
assertEquals("cm:modifier not preserved during import", AuthenticationUtil.getFullyAuthenticatedUser(), modifier);
|
assertEquals("cm:modifier not preserved during import", AuthenticationUtil.getSystemUserName(), modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -200,7 +200,7 @@ public class ScriptNodeTest
|
|||||||
@Before public void createTestContent()
|
@Before public void createTestContent()
|
||||||
{
|
{
|
||||||
excludedOnUpdateProps = VERSIONABLE_ASPECT.getExcludedOnUpdateProps();
|
excludedOnUpdateProps = VERSIONABLE_ASPECT.getExcludedOnUpdateProps();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
// Create the store and get the root node
|
// Create the store and get the root node
|
||||||
storeRef = NODE_SERVICE.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
storeRef = NODE_SERVICE.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
||||||
rootNodeRef = NODE_SERVICE.getRootNode(storeRef);
|
rootNodeRef = NODE_SERVICE.getRootNode(storeRef);
|
||||||
|
@@ -624,7 +624,7 @@ public class FileFolderPerformanceTester extends TestCase
|
|||||||
NodeRef folderNodeRef = null;
|
NodeRef folderNodeRef = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
if (selectedFolderNodeRef == null)
|
if (selectedFolderNodeRef == null)
|
||||||
{
|
{
|
||||||
// find the guest folder
|
// find the guest folder
|
||||||
|
@@ -86,7 +86,7 @@ public class DbNodeServiceImplPropagationTest extends BaseSpringTest
|
|||||||
|
|
||||||
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
|
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
|
||||||
|
|
||||||
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
|
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
|
||||||
// load the system model
|
// load the system model
|
||||||
|
@@ -126,7 +126,7 @@ public class NotificationServiceImplSystemTest extends BaseAlfrescoTestCase
|
|||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
// As system user
|
// As system user
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Create people and users
|
// Create people and users
|
||||||
fromPerson = createPerson(FROM_USER, PASSWORD, FROM_FIRST_NAME, FROM_LAST_NAME, FROM_EMAIL);
|
fromPerson = createPerson(FROM_USER, PASSWORD, FROM_FIRST_NAME, FROM_LAST_NAME, FROM_EMAIL);
|
||||||
@@ -157,7 +157,7 @@ public class NotificationServiceImplSystemTest extends BaseAlfrescoTestCase
|
|||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
// As system user
|
// As system user
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Delete the template
|
// Delete the template
|
||||||
nodeService.deleteNode(template);
|
nodeService.deleteNode(template);
|
||||||
|
@@ -32,6 +32,7 @@ import java.util.List;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.model.Repository;
|
import org.alfresco.repo.model.Repository;
|
||||||
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
|
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.rendition.RenditionDefinition;
|
import org.alfresco.service.cmr.rendition.RenditionDefinition;
|
||||||
@@ -121,6 +122,10 @@ public class XSLTRenderingEngineTest extends BaseAlfrescoSpringTest
|
|||||||
@Test
|
@Test
|
||||||
public void testSimplestTemplateWithTargetPath() throws Exception
|
public void testSimplestTemplateWithTargetPath() throws Exception
|
||||||
{
|
{
|
||||||
|
// We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System)
|
||||||
|
// so that we can setup the Person object in the ScriptNode
|
||||||
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileInfo file = createXmlFile(companyHome);
|
FileInfo file = createXmlFile(companyHome);
|
||||||
@@ -147,6 +152,11 @@ public class XSLTRenderingEngineTest extends BaseAlfrescoSpringTest
|
|||||||
log.error("Error!", ex);
|
log.error("Error!", ex);
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ public class AuthenticationTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deleteAndy();
|
deleteAndy();
|
||||||
@@ -224,7 +224,7 @@ public class AuthenticationTest extends TestCase
|
|||||||
personAndyNodeRef = nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
|
personAndyNodeRef = nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
|
||||||
assertNotNull(personAndyNodeRef);
|
assertNotNull(personAndyNodeRef);
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
authenticationComponent.clearCurrentSecurityContext();
|
authenticationComponent.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ public class ResetPasswordServiceImplTest
|
|||||||
public static final ApplicationContextInit APP_CONTEXT_INIT = new ApplicationContextInit();
|
public static final ApplicationContextInit APP_CONTEXT_INIT = new ApplicationContextInit();
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final RunAsFullyAuthenticatedRule runAsRule = new RunAsFullyAuthenticatedRule(AuthenticationUtil.getAdminUserName());
|
public final RunAsFullyAuthenticatedRule runAsRule = new RunAsFullyAuthenticatedRule(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
private static final String DEFAULT_SENDER = "noreply@test-alfresco.test";
|
private static final String DEFAULT_SENDER = "noreply@test-alfresco.test";
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ public class ResetPasswordServiceImplTest
|
|||||||
|
|
||||||
// Make sure to run as system
|
// Make sure to run as system
|
||||||
AuthenticationUtil.clearCurrentSecurityContext();
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setRunAsUserSystem();
|
||||||
|
|
||||||
// Request password reset
|
// Request password reset
|
||||||
resetPasswordService.requestReset(testPerson.userName, "share");
|
resetPasswordService.requestReset(testPerson.userName, "share");
|
||||||
|
@@ -107,7 +107,7 @@ public class UpgradePasswordHashTest extends TestCase
|
|||||||
upgradePasswordHashWorker = (UpgradePasswordHashWorker)ctx.getBean("upgradePasswordHashWorker");
|
upgradePasswordHashWorker = (UpgradePasswordHashWorker)ctx.getBean("upgradePasswordHashWorker");
|
||||||
nodeService = serviceRegistry.getNodeService();
|
nodeService = serviceRegistry.getNodeService();
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createTestUsers(String encoding) throws Exception
|
protected void createTestUsers(String encoding) throws Exception
|
||||||
|
@@ -91,7 +91,7 @@ public class SubscriptionServiceImplTest extends TestCase
|
|||||||
searchService = (SearchService) ctx.getBean("SearchService");
|
searchService = (SearchService) ctx.getBean("SearchService");
|
||||||
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
|
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
|
||||||
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
txn = transactionService.getNonPropagatingUserTransaction(false);
|
txn = transactionService.getNonPropagatingUserTransaction(false);
|
||||||
txn.begin();
|
txn.begin();
|
||||||
|
@@ -887,7 +887,7 @@ public class MultiTDemoTest extends TestCase
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
deleteTenant(tenantDomain1);
|
deleteTenant(tenantDomain1);
|
||||||
deleteTenant(tenantDomain2);
|
deleteTenant(tenantDomain2);
|
||||||
|
@@ -41,6 +41,7 @@ import org.apache.commons.lang.mutable.MutableInt;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public class StartWorkflowActionExecuterTest extends BaseSpringTest
|
|||||||
this.personService = (PersonService)this.applicationContext.getBean("personService");
|
this.personService = (PersonService)this.applicationContext.getBean("personService");
|
||||||
|
|
||||||
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
|
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
|
||||||
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
|
||||||
|
|
||||||
// Create the store and get the root node
|
// Create the store and get the root node
|
||||||
rootNodeRef = nodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
|
rootNodeRef = nodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
|
||||||
|
@@ -264,6 +264,8 @@ public class ActivitiTimerExecutionTest extends BaseSpringTest
|
|||||||
PersonService personService = registry.getPersonService();
|
PersonService personService = registry.getPersonService();
|
||||||
|
|
||||||
this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
|
this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
|
||||||
|
|
||||||
|
authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForTimersToBeExecuted(String workflowInstanceId) throws Exception
|
private void waitForTimersToBeExecuted(String workflowInstanceId) throws Exception
|
||||||
|
@@ -178,7 +178,7 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
|
|||||||
@Test
|
@Test
|
||||||
public void testReviewAndPooledNotModifiedDate()
|
public void testReviewAndPooledNotModifiedDate()
|
||||||
{
|
{
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
||||||
props.put(ContentModel.PROP_NAME, "MNT-11522-testfile.txt");
|
props.put(ContentModel.PROP_NAME, "MNT-11522-testfile.txt");
|
||||||
|
@@ -31,7 +31,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|
||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
@@ -94,7 +93,7 @@ public abstract class BaseAlfrescoSpringTest extends BaseSpringTest
|
|||||||
// Authenticate as the system user
|
// Authenticate as the system user
|
||||||
authenticationComponent = (AuthenticationComponent) this.applicationContext
|
authenticationComponent = (AuthenticationComponent) this.applicationContext
|
||||||
.getBean("authenticationComponent");
|
.getBean("authenticationComponent");
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
// Create the store and get the root node
|
// Create the store and get the root node
|
||||||
this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
||||||
|
Reference in New Issue
Block a user