mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
127160 cturlica: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 127134 cturlica: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 127102 rmunteanu: MNT-15614 : Site with name "IT" cannot be managed properly - Changed the way the role name is striped out. - Implemented tests. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127868 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2262,10 +2262,11 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
|
|||||||
List<String> groups = getPermissionGroups(shortName, authorityName);
|
List<String> groups = getPermissionGroups(shortName, authorityName);
|
||||||
for (String group : groups)
|
for (String group : groups)
|
||||||
{
|
{
|
||||||
int index = group.indexOf(shortName) + shortName.length();
|
String shortNamePattern = '_' + shortName + '_';
|
||||||
|
int index = group.lastIndexOf(shortNamePattern) + (shortNamePattern).length();
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
result.add(group.substring(index + 1));
|
result.add(group.substring(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@@ -40,6 +40,7 @@ import javax.mail.internet.MimeMessage;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.action.executer.MailActionExecuter;
|
import org.alfresco.repo.action.executer.MailActionExecuter;
|
||||||
import org.alfresco.repo.management.subsystems.ApplicationContextFactory;
|
import org.alfresco.repo.management.subsystems.ApplicationContextFactory;
|
||||||
|
import org.alfresco.repo.processor.TemplateServiceImpl;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.site.SiteModel;
|
import org.alfresco.repo.site.SiteModel;
|
||||||
@@ -51,9 +52,7 @@ import org.alfresco.service.cmr.invitation.InvitationService;
|
|||||||
import org.alfresco.service.cmr.invitation.ModeratedInvitation;
|
import org.alfresco.service.cmr.invitation.ModeratedInvitation;
|
||||||
import org.alfresco.service.cmr.invitation.NominatedInvitation;
|
import org.alfresco.service.cmr.invitation.NominatedInvitation;
|
||||||
import org.alfresco.service.cmr.repository.TemplateService;
|
import org.alfresco.service.cmr.repository.TemplateService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
@@ -62,7 +61,6 @@ import org.alfresco.util.PropertyMap;
|
|||||||
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.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.alfresco.repo.processor.TemplateServiceImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests of Invitation Service
|
* Unit tests of Invitation Service
|
||||||
@@ -661,6 +659,39 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MNT-15614 Site with name "IT" cannot be managed properly
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void test_MNT15614() throws Exception
|
||||||
|
{
|
||||||
|
String[] siteNames = {"it", "site", "GROUP"};
|
||||||
|
String inviteeUserName = USER_ONE;
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String acceptUrl = "froob";
|
||||||
|
String rejectUrl = "marshmallow";
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
|
||||||
|
for (String siteName : siteNames)
|
||||||
|
{
|
||||||
|
SiteInfo siteInfoRed = siteService.getSite(siteName);
|
||||||
|
if (siteInfoRed == null)
|
||||||
|
{
|
||||||
|
siteService.createSite("InviteSitePreset", siteName, "InviteSiteTitle",
|
||||||
|
"InviteSiteDescription", SiteVisibility.MODERATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invite user
|
||||||
|
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
|
||||||
|
inviteeUserName, resourceType, siteName, inviteeRole, acceptUrl, rejectUrl);
|
||||||
|
assertNotNull("nominated invitation is null", nominatedInvitation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test nominated user - new user with whitespace in name. Related to
|
* Test nominated user - new user with whitespace in name. Related to
|
||||||
* ETHREEOH-3030.
|
* ETHREEOH-3030.
|
||||||
|
@@ -869,6 +869,33 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
startNewTransaction();
|
startNewTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMNT_15614() throws Exception
|
||||||
|
{
|
||||||
|
RetryingTransactionCallback<Object> work = new RetryingTransactionCallback<Object>()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute() throws Throwable
|
||||||
|
{
|
||||||
|
String[] siteNames = { "it", "site", "GROUP" };
|
||||||
|
|
||||||
|
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
|
||||||
|
for (String siteName : siteNames)
|
||||||
|
{
|
||||||
|
siteService.createSite(siteName, siteName, siteName, siteName, SiteVisibility.PUBLIC);
|
||||||
|
assertEquals( SiteModel.SITE_MANAGER, siteService.getMembersRole(siteName, AuthenticationUtil.getAdminUserName()));
|
||||||
|
siteService.deleteSite(siteName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
endTransaction();
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(work);
|
||||||
|
startNewTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test listSite case sensitivity
|
* Test listSite case sensitivity
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user