Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

75516: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud)
      75147: MNT-11789: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.3)
         75140: MNT-11788: Merged V4.1.8 (4.1.8.11) to V4.1-BUG-FIX (4.1.10)
            74982: MNT-11766 : User with username starting with admin gets admin rights
               - MultiTServiceImpl#getBaseNameUser was modified to return base name as part of user name before @ symbol only for real existing tenant domains. If no tenant domain is actually found original username is returned as base name.
         75141: MNT-11788: Merged V4.1.8 (4.1.8.11) to V4.1-BUG-FIX (4.1.10)
            75139: MNT-11766 : User with username starting with admin gets admin rights
               - Just reformat (no code change) to find out if it is possible to use the same
                 fix for >= 4.2.N (which had already been reformatted), as it was not possible
                 to see given the large number of format changes.
         75145: Merged V4.1.9 (4.1.9) to V4.1-BUG-FIX (4.1.10) (RECORD ONLY)
            75143: Merged V4.1-BUG-FIX (4.1.10) to V4.1.9 (4.1.9)
               75140: MNT-11788: Merged V4.1.8 (4.1.8.11) to V4.1-BUG-FIX (4.1.10)
                  74982: MNT-11766 : User with username starting with admin gets admin rights
                     - MultiTServiceImpl#getBaseNameUser was modified to return base name as part of user name before @ symbol only for real existing tenant domains. If no tenant domain is actually found original username is returned as base name.
         75146: Merged V4.1.9 (4.1.9) to V4.1-BUG-FIX (4.1.10) (RECORD ONLY)
            75144: Merged V4.1-BUG-FIX (4.1.10) to V4.1.9 (4.1.9)
               75141: MNT-11788: Merged V4.1.8 (4.1.8.11) to V4.1-BUG-FIX (4.1.10)
                  75139: MNT-11766 : User with username starting with admin gets admin rights
                     - Just reformat (no code change) to find out if it is possible to use the same
                       fix for >= 4.2.N (which had already been reformatted), as it was not possible
                       to see given the large number of format changes.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77478 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 12:49:39 +00:00
parent e208531988
commit 238a2a02c1

View File

@@ -401,9 +401,23 @@ public class MultiTServiceImpl implements TenantService
if (name != null) if (name != null)
{ {
int idx = name.lastIndexOf(SEPARATOR); int idx = name.lastIndexOf(SEPARATOR);
if (idx != -1) if (idx > 0 && (idx < (name.length() - 1)))
{ {
return name.substring(0, idx); String domainPart = getTenantDomain(name.substring(idx + 1));
String baseName = name.substring(0, idx);
// MNT-11766 fix, check whether tenant domain actually exists
Tenant tenant = getTenant(domainPart);
if (tenant == null)
{
// tenant domain doesn't exists but we are allowed to create non-tenant users with name like admin@test
// no base name can be resolved for such users -> return original name
return name;
}
else
{
return baseName;
}
} }
} }
return name; return name;