From 75c151e08d4eefa2d781647906a6eb589b681a94 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 21 Feb 2015 07:53:00 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 97693: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 97683: Merged 5.0.1 (5.0.1) to 5.0.N (5.0.2) 97651: Merged DEV to PATCHES/5.0.1 (5.0.1) 97532 : MNT-13418 : When performing upgrade with a tenant, patch.siteAdministrators and patch.alfrescoSearchAdministrators throw an error - Using AuthenticationUtils to get administrator's username git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@97705 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/patch/patch-services-context.xml | 6 ----- .../patch/impl/AddGroupAuthorityPatch.java | 22 +++---------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index e3e26a0ae6..d32129b163 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -920,9 +920,6 @@ SITE_ADMINISTRATORS - - ${alfresco_user_store.adminusername} - APP.DEFAULT @@ -955,9 +952,6 @@ ALFRESCO_SEARCH_ADMINISTRATORS - - ${alfresco_user_store.adminusername} - APP.DEFAULT diff --git a/source/java/org/alfresco/repo/admin/patch/impl/AddGroupAuthorityPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/AddGroupAuthorityPatch.java index fbea9e773c..4203511d01 100644 --- a/source/java/org/alfresco/repo/admin/patch/impl/AddGroupAuthorityPatch.java +++ b/source/java/org/alfresco/repo/admin/patch/impl/AddGroupAuthorityPatch.java @@ -22,6 +22,7 @@ package org.alfresco.repo.admin.patch.impl; import java.util.Set; import org.alfresco.repo.admin.patch.AbstractPatch; +import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.security.AuthorityService; import org.alfresco.service.cmr.security.AuthorityType; import org.springframework.extensions.surf.util.I18NUtil; @@ -76,13 +77,8 @@ public class AddGroupAuthorityPatch extends AbstractPatch this.groupAuthorityDetails.groupDisplayName, this.groupAuthorityDetails.authorityZones); - if (this.groupAuthorityDetails.adminUserName != null - && authorityService.isAdminAuthority(this.groupAuthorityDetails.adminUserName)) - { - // Add admin as a member of the created group - authorityService.addAuthority(groupAuthorityName, - this.groupAuthorityDetails.adminUserName); - } + authorityService.addAuthority(groupAuthorityName, AuthenticationUtil.getAdminUserName()); + result.append(I18NUtil.getMessage(MSG_RESULT, groupAuthorityName)); return result.toString(); @@ -97,7 +93,6 @@ public class AddGroupAuthorityPatch extends AbstractPatch { private String groupName; private String groupDisplayName; - private String adminUserName; private Set authorityZones; /** @@ -116,17 +111,6 @@ public class AddGroupAuthorityPatch extends AbstractPatch this.groupDisplayName = groupDisplayName; } - /** - * Sets the Admin's username, so it can be included as a member of the - * group. If null, an empty group will be created. - * - * @param adminUserName the adminUserName to set - */ - public void setAdminUserName(String adminUserName) - { - this.adminUserName = adminUserName; - } - /** * @param authorityZones the authorityZones to set */