mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
102708: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 102489: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2) 102284: Merged DEV to V4.2-BUG-FIX 101812 : MNT-13710 : User cannot change site role if its current role contains an underscore - Added new unit test. Corrected some code. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@103538 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2239,7 +2239,7 @@ 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.lastIndexOf('_');
|
int index = group.indexOf(shortName) + shortName.length();
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
result.add(group.substring(index + 1));
|
result.add(group.substring(index + 1));
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
package org.alfresco.repo.site;
|
package org.alfresco.repo.site;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -67,6 +69,7 @@ import org.alfresco.service.cmr.tagging.TaggingService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.test_category.BaseSpringTestsCategory;
|
import org.alfresco.test_category.BaseSpringTestsCategory;
|
||||||
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.util.BaseAlfrescoSpringTest;
|
import org.alfresco.util.BaseAlfrescoSpringTest;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
@@ -659,6 +662,60 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] getConfigLocations()
|
||||||
|
{
|
||||||
|
String[] existingConfigLocations = ApplicationContextHelper.CONFIG_LOCATIONS;
|
||||||
|
|
||||||
|
List<String> locations = Arrays.asList(existingConfigLocations);
|
||||||
|
List<String> mutableLocationsList = new ArrayList<String>(locations);
|
||||||
|
mutableLocationsList.add("classpath:org/alfresco/repo/site/site-custom-context.xml");
|
||||||
|
|
||||||
|
String[] result = mutableLocationsList.toArray(new String[mutableLocationsList.size()]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMNT_13710() throws Exception
|
||||||
|
{
|
||||||
|
final String user = "user";
|
||||||
|
|
||||||
|
String siteName = "test" + System.currentTimeMillis();
|
||||||
|
|
||||||
|
List<String> roleList = new ArrayList<String>();
|
||||||
|
roleList.add("test_customrole");
|
||||||
|
roleList.add("testCustomrole");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
|
||||||
|
SiteInfo siteInfo = this.siteService.createSite(siteName, siteName, siteName, siteName, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
|
createUser(user, user);
|
||||||
|
|
||||||
|
for(String role : roleList)
|
||||||
|
{
|
||||||
|
this.siteService.setMembership(siteInfo.getShortName(), user, role);
|
||||||
|
|
||||||
|
List<String> list = this.siteServiceImpl.getMembersRoles(siteName, user);
|
||||||
|
|
||||||
|
assertTrue(list.contains(role));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (siteService.getSite(siteName) != null)
|
||||||
|
{
|
||||||
|
siteService.deleteSite(siteName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.personService.getPerson(user) != null)
|
||||||
|
{
|
||||||
|
this.personService.deletePerson(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test listSite case sensitivity
|
* Test listSite case sensitivity
|
||||||
*/
|
*/
|
||||||
|
@@ -36,6 +36,14 @@
|
|||||||
<includePermissionGroup permissionGroup="Coordinator" type="cm:cmobject" />
|
<includePermissionGroup permissionGroup="Coordinator" type="cm:cmobject" />
|
||||||
</permissionGroup>
|
</permissionGroup>
|
||||||
|
|
||||||
|
<permissionGroup name="test_customrole" allowFullControl="false" expose="true">
|
||||||
|
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
|
||||||
|
</permissionGroup>
|
||||||
|
|
||||||
|
<permissionGroup name="testCustomrole" allowFullControl="false" expose="true">
|
||||||
|
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
|
||||||
|
</permissionGroup>
|
||||||
|
|
||||||
</permissionSet>
|
</permissionSet>
|
||||||
|
|
||||||
</permissions>
|
</permissions>
|
Reference in New Issue
Block a user