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

76565: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      76177: Merged DEV to V4.2-BUG-FIX (4.2.3)
         74967 : MNT-11749 : It is possible to create groups with same name in race conditions
            - Disallow creation of authorities with equal names
         76118 : MNT-11749 : It is possible to create groups with same name in race conditions
            - Remove throwing AlfrescoRuntimeException for duplicated authorities. Fix related test


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 15:31:28 +00:00
parent d46b75c752
commit 77222c3023
3 changed files with 42 additions and 14 deletions

View File

@@ -86,6 +86,7 @@ import org.alfresco.util.ParameterCheck;
import org.alfresco.util.PropertyCheck;
import org.alfresco.util.SearchLanguageConversion;
import org.alfresco.util.registry.NamedObjectRegistry;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
@@ -367,6 +368,8 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
public void createAuthority(String name, String authorityDisplayName, Set<String> authorityZones)
{
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
/* MNT-11749 : Alfresco allows to create authorities with different char cases, but disallow duplicates */
props.put(ContentModel.PROP_NAME, DigestUtils.md5Hex(name));
props.put(ContentModel.PROP_AUTHORITY_NAME, name);
props.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, authorityDisplayName);
NodeRef childRef;

View File

@@ -596,12 +596,6 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
checkTypeIsMutable(type);
String name = getName(type, shortName);
//MNT-9794 fix. If authority with 'name' exists it is an error - in line with person creation
if (authorityExists(name))
{
throw new AlfrescoRuntimeException("Authority '" + name + "' already exists.");
}
authorityDAO.createAuthority(name, authorityDisplayName, authorityZones);
return name;