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
|
// Do a blanket removal in case this is a contextual nodes
|
||||||
attributeService.removeAttributes(CONTEXT_VALUE, nodeRef);
|
attributeService.removeAttributes(CONTEXT_VALUE, nodeRef);
|
||||||
}
|
}
|
||||||
else
|
else if(!beforeId.equals(afterId))
|
||||||
{
|
{
|
||||||
// This is a full update
|
// This is a full update
|
||||||
attributeService.updateOrCreateAttribute(
|
attributeService.updateOrCreateAttribute(
|
||||||
|
@@ -56,6 +56,7 @@ import org.alfresco.util.Pair;
|
|||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.extensions.webscripts.ui.common.StringUtils;
|
import org.springframework.extensions.webscripts.ui.common.StringUtils;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
@@ -355,18 +356,9 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
|||||||
Pair<String, Integer> groupResult = findIPRGroup(groupPrefix, authorities);
|
Pair<String, Integer> groupResult = findIPRGroup(groupPrefix, authorities);
|
||||||
|
|
||||||
if (groupResult.getFirst() == null)
|
if (groupResult.getFirst() == null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond());
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
group = groupResult.getFirst();
|
group = groupResult.getFirst();
|
||||||
@@ -530,7 +522,10 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
|||||||
String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index);
|
String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index);
|
||||||
|
|
||||||
// create group
|
// create group
|
||||||
String group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM));
|
String group;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM));
|
||||||
|
|
||||||
// add root parent
|
// add root parent
|
||||||
authorityService.addAuthority(getRootIRPGroup(), group);
|
authorityService.addAuthority(getRootIRPGroup(), group);
|
||||||
@@ -540,13 +535,18 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
for (String child : children)
|
for (String child : children)
|
||||||
{
|
{
|
||||||
if (authorityService.authorityExists(child) &&
|
if (authorityService.authorityExists(child) && !PermissionService.ALL_AUTHORITIES.equals(child))
|
||||||
!PermissionService.ALL_AUTHORITIES.equals(child))
|
|
||||||
{
|
{
|
||||||
authorityService.addAuthority(group, child);
|
authorityService.addAuthority(group, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(DuplicateChildNodeNameException ex)
|
||||||
|
{
|
||||||
|
// the group was concurrently created
|
||||||
|
group = authorityService.getName(AuthorityType.GROUP, groupShortName);
|
||||||
|
}
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user