mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
75525: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud) 75287: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.3) 75284: Merged V4.1.8 (4.1.8.11) to V4.1-BUG-FIX (4.1.10) 75265: MNT-11766 : User with username starting with admin gets admin rights - Previous fix was corrected according to Derek's review. - Unit test that demonstrates fix added. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77485 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1420,6 +1420,30 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals("Count of groups must increment", (groupCountBefore+1), groupCountAfter);
|
||||
}
|
||||
|
||||
public void testMNT_11766()
|
||||
{
|
||||
Set<String> admins = authenticationComponent.getDefaultAdministratorUserNames();
|
||||
|
||||
for (String admin : admins)
|
||||
{
|
||||
// create user with MT format name (i.e. username@domain)
|
||||
String user = admin + "@" + System.currentTimeMillis();
|
||||
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
props.put(ContentModel.PROP_USERNAME, user);
|
||||
props.put(ContentModel.PROP_FIRSTNAME, user);
|
||||
props.put(ContentModel.PROP_LASTNAME, user);
|
||||
props.put(ContentModel.PROP_EMAIL, user + "@gmail.com");
|
||||
|
||||
personService.createPerson(props);
|
||||
authenticationService.createAuthentication(user, "123123".toCharArray());
|
||||
|
||||
authenticationComponent.setCurrentUser(user);
|
||||
assertFalse("User should not have administrator role.", authorityService.hasAdminAuthority());
|
||||
assertFalse("User should not have administrator role.", pubAuthorityService.hasAdminAuthority());
|
||||
}
|
||||
}
|
||||
|
||||
private void assertContains(List<String> results, List<String> checklist, boolean included)
|
||||
{
|
||||
for (String check : checklist)
|
||||
|
Reference in New Issue
Block a user