mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13256: Fix ETHREEOH-1221 Hard-coded use of "admin" username ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V3.1:r13256 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13613 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -112,7 +113,7 @@ public class WebProjectTest extends BaseWebScriptTest
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Tidy-up any web projects created during the execution of the test
|
||||
for (String webProjectRef : this.createdWebProjects)
|
||||
@@ -133,7 +134,7 @@ public class WebProjectTest extends BaseWebScriptTest
|
||||
|
||||
public void testBasicCRUDWebProject() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
sendRequest(new DeleteRequest(URL_WEB_PROJECTS + "/" + BASIC_DNSNAME),0 );
|
||||
|
||||
@@ -201,7 +202,7 @@ public class WebProjectTest extends BaseWebScriptTest
|
||||
{
|
||||
int LOOP_COUNT = 5;
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
for(int i = 0; i < LOOP_COUNT; i++)
|
||||
{
|
||||
@@ -262,7 +263,7 @@ public class WebProjectTest extends BaseWebScriptTest
|
||||
|
||||
public void testUpdateWebProject() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
/**
|
||||
* Create a web site
|
||||
|
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -55,7 +56,6 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
private static final String USER_ONE = "WebProjectTestOne";
|
||||
private static final String USER_TWO = "WebProjectTestTwo";
|
||||
private static final String USER_THREE = "WebProjectTestThree";
|
||||
private static final String USER_ADMIN = "admin";
|
||||
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
||||
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
|
||||
@@ -113,7 +113,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Tidy-up any web projects created during the execution of the test
|
||||
for (String webProjectRef : this.createdWebProjects)
|
||||
@@ -161,7 +161,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
|
||||
public void testListMemberships() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Create a site
|
||||
String webProjectRef = createWebProject();
|
||||
@@ -268,7 +268,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
|
||||
public void testCreateMemberships() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser(USER_ADMIN);
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
String webProjectRef = createWebProject();
|
||||
|
||||
@@ -356,7 +356,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
|
||||
public void testGetMembership() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser(USER_ADMIN);
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Create a site
|
||||
String webProjectRef = createWebProject();
|
||||
@@ -371,13 +371,13 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
/**
|
||||
* Now lookup the admin user and check they are a content manager
|
||||
*/
|
||||
Response response = sendRequest(new GetRequest(validURL + "/" + USER_ADMIN), Status.STATUS_OK);
|
||||
Response response = sendRequest(new GetRequest(validURL + "/" + AuthenticationUtil.getAdminUserName()), Status.STATUS_OK);
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
|
||||
// Check the result
|
||||
assertEquals(ROLE_CONTENT_MANAGER, data.get("role"));
|
||||
assertEquals(USER_ADMIN, data.getJSONObject("person").get("userName"));
|
||||
assertEquals(AuthenticationUtil.getAdminUserName(), data.getJSONObject("person").get("userName"));
|
||||
}
|
||||
|
||||
// Update Not yet implemented
|
||||
@@ -468,7 +468,7 @@ public class WebProjectMembershipTest extends BaseWebScriptTest
|
||||
|
||||
public void testDeleteMembership() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser(USER_ADMIN);
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
String webProjectRef = createWebProject();
|
||||
|
||||
|
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -57,7 +58,6 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
private static final String USER_TWO = "WebProjectTestTwo";
|
||||
private static final String USER_THREE = "WebProjectTestThree";
|
||||
private static final String USER_FOUR = "WebProjectTestFour";
|
||||
private static final String USER_ADMIN = "admin";
|
||||
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
||||
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
|
||||
@@ -199,7 +199,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Tidy-up any web projects created during the execution of the test
|
||||
for (String webProjectRef : this.createdWebProjects)
|
||||
@@ -224,7 +224,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testModifiedAssetsWebAppTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -268,7 +268,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
|
||||
assertNotNull("name is null", name);
|
||||
assertEquals("name is wrong", "yellowFile1", name);
|
||||
assertEquals("creator is wrong", "admin", creator);
|
||||
assertEquals("creator is wrong", AuthenticationUtil.getAdminUserName(), creator);
|
||||
assertTrue("not isFile", isFile);
|
||||
assertFalse("not isFolder", isFolder);
|
||||
assertFalse("not isDeleted", isDeleted);
|
||||
@@ -284,7 +284,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testModifiedAssetsTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -344,7 +344,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
|
||||
assertNotNull("name is null", name);
|
||||
assertEquals("name is wrong", "myFile1", name);
|
||||
assertEquals("creator is wrong", "admin", creator);
|
||||
assertEquals("creator is wrong", AuthenticationUtil.getAdminUserName(), creator);
|
||||
assertTrue("not isFile", isFile);
|
||||
assertFalse("not isDirectory", isFolder);
|
||||
assertFalse("not isDeleted", isDeleted);
|
||||
@@ -398,7 +398,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testSubmitAssetsTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -671,7 +671,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testSubmitAssetsWebAppTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -727,7 +727,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testRevertAssetsTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -961,7 +961,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testRevertAssetsWebAppTest() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -1017,7 +1017,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
final String YELLOW_FILE = "YellowFile.xyz";
|
||||
final String ROOT_FILE = "index.htm";
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -1119,7 +1119,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
final String YELLOW_FILE2 = "Buffy.jpg";
|
||||
final String ROOT_FILE = "index.htm";
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -1206,7 +1206,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
final String YELLOW_FILE = "YellowFile.xyz";
|
||||
final String ROOT_FILE = "index.htm";
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -1311,7 +1311,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
final String PURPLE_FILE2 = "willow.htm";
|
||||
final String ROOT_MOVED_FILE = "smashing.htm";
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
@@ -1391,7 +1391,7 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
final String YELLOW_FILE = "buffy.jpg";
|
||||
final String ROOT_FILE = "index.htm";
|
||||
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||
|
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -59,7 +60,6 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
private static final String USER_TWO = "WebProjectTestTwo";
|
||||
private static final String USER_THREE = "WebProjectTestThree";
|
||||
private static final String USER_FOUR = "WebProjectTestFour";
|
||||
private static final String USER_ADMIN = "admin";
|
||||
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
||||
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
|
||||
@@ -133,7 +133,7 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Tidy-up any web projects created during the execution of the test
|
||||
for (String webProjectRef : this.createdWebProjects)
|
||||
@@ -187,7 +187,7 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testCreateSandbox() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
String webprojref = createWebProject();
|
||||
|
||||
@@ -259,7 +259,7 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testListSandbox() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
|
||||
/**
|
||||
@@ -363,7 +363,7 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testGetSandbox() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
String webprojref = createWebProject();
|
||||
|
||||
@@ -432,7 +432,7 @@ public class SandboxTest extends BaseWebScriptTest {
|
||||
*/
|
||||
public void testDeleteSandbox() throws Exception
|
||||
{
|
||||
this.authenticationComponent.setCurrentUser("admin");
|
||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||
String webprojref = createWebProject();
|
||||
|
||||
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||
|
Reference in New Issue
Block a user