mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-2027 Admin user is always "admin", system user is always "system".
+review RM-9 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@101018 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,14 +39,14 @@ public class MockAuthenticationUtilHelper
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set up a Mockito mock <code>AuthenticationUtil</code> so that it executes all methods assuming the user has
|
* Set up a Mockito mock <code>AuthenticationUtil</code> so that it executes all methods assuming the user has
|
||||||
* permissions. If the mock is asked for details about the user then it assumes the user is "admin".
|
* permissions. If the mock is asked for details about the user then it assumes the currently authenticated user is
|
||||||
|
* "admin".
|
||||||
*
|
*
|
||||||
* @param mockAuthenticationUtil The mock to initialise.
|
* @param mockAuthenticationUtil The mock to initialise.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static void setup(AuthenticationUtil mockAuthenticationUtil)
|
public static void setup(AuthenticationUtil mockAuthenticationUtil)
|
||||||
{
|
{
|
||||||
setup(mockAuthenticationUtil, "admin", "admin", "admin");
|
setup(mockAuthenticationUtil, "admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,13 +54,10 @@ public class MockAuthenticationUtilHelper
|
|||||||
* permissions.
|
* permissions.
|
||||||
*
|
*
|
||||||
* @param mockAuthenticationUtil The mock to initialise.
|
* @param mockAuthenticationUtil The mock to initialise.
|
||||||
* @param adminUserName The name of the default admin user.
|
|
||||||
* @param fullyAuthenticatedUser The name of the user that last authenticated.
|
* @param fullyAuthenticatedUser The name of the user that last authenticated.
|
||||||
* @param systemUserName The name of the system user.
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void setup(AuthenticationUtil mockAuthenticationUtil, String adminUserName,
|
public static void setup(AuthenticationUtil mockAuthenticationUtil, String fullyAuthenticatedUser)
|
||||||
String fullyAuthenticatedUser, String systemUserName)
|
|
||||||
{
|
{
|
||||||
reset(mockAuthenticationUtil);
|
reset(mockAuthenticationUtil);
|
||||||
|
|
||||||
@@ -90,9 +87,8 @@ public class MockAuthenticationUtilHelper
|
|||||||
|
|
||||||
}).when(mockAuthenticationUtil).<Object> runAs(any(RunAsWork.class), anyString());
|
}).when(mockAuthenticationUtil).<Object> runAs(any(RunAsWork.class), anyString());
|
||||||
|
|
||||||
// assume admin
|
doReturn("admin").when(mockAuthenticationUtil).getAdminUserName();
|
||||||
doReturn(adminUserName).when(mockAuthenticationUtil).getAdminUserName();
|
|
||||||
doReturn(fullyAuthenticatedUser).when(mockAuthenticationUtil).getFullyAuthenticatedUser();
|
doReturn(fullyAuthenticatedUser).when(mockAuthenticationUtil).getFullyAuthenticatedUser();
|
||||||
doReturn(systemUserName).when(mockAuthenticationUtil).getSystemUserName();
|
doReturn("system").when(mockAuthenticationUtil).getSystemUserName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user