mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-4673 - moved try catch in the create method so we can use the group name and fixed an update attribute bug
(cherry picked from commit 9a47da1e6ff050144629ebdd1692bcf9ee35bb56)
This commit is contained in:
@@ -243,7 +243,7 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
// Do a blanket removal in case this is a contextual nodes
|
||||
attributeService.removeAttributes(CONTEXT_VALUE, nodeRef);
|
||||
}
|
||||
else
|
||||
else if(!beforeId.equals(afterId))
|
||||
{
|
||||
// This is a full update
|
||||
attributeService.updateOrCreateAttribute(
|
||||
|
@@ -56,6 +56,7 @@ import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.extensions.webscripts.ui.common.StringUtils;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
@@ -356,16 +357,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
|
||||
if (groupResult.getFirst() == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond());
|
||||
}
|
||||
catch(DuplicateChildNodeNameException ex)
|
||||
{
|
||||
// the group was concurrently created, try to get it again
|
||||
groupResult = findIPRGroup(groupPrefix, authorities);
|
||||
group = groupResult.getFirst();
|
||||
}
|
||||
group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -530,23 +522,31 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index);
|
||||
|
||||
// create group
|
||||
String group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM));
|
||||
|
||||
// add root parent
|
||||
authorityService.addAuthority(getRootIRPGroup(), group);
|
||||
|
||||
// add children if provided
|
||||
if (children != null)
|
||||
String group;
|
||||
try
|
||||
{
|
||||
for (String child : children)
|
||||
group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM));
|
||||
|
||||
// add root parent
|
||||
authorityService.addAuthority(getRootIRPGroup(), group);
|
||||
|
||||
// add children if provided
|
||||
if (children != null)
|
||||
{
|
||||
if (authorityService.authorityExists(child) &&
|
||||
!PermissionService.ALL_AUTHORITIES.equals(child))
|
||||
for (String child : children)
|
||||
{
|
||||
authorityService.addAuthority(group, child);
|
||||
if (authorityService.authorityExists(child) && !PermissionService.ALL_AUTHORITIES.equals(child))
|
||||
{
|
||||
authorityService.addAuthority(group, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(DuplicateChildNodeNameException ex)
|
||||
{
|
||||
// the group was concurrently created
|
||||
group = authorityService.getName(AuthorityType.GROUP, groupShortName);
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
Reference in New Issue
Block a user