ACS-3364 Add permission handling to linkedToBy. (#1425)

This commit is contained in:
Tom Page
2022-09-21 15:18:30 +01:00
committed by GitHub
parent e0844d72e1
commit c4d432b136
5 changed files with 75 additions and 10 deletions

View File

@@ -30,7 +30,6 @@ import static org.alfresco.rest.api.model.rules.InclusionType.LINKED;
import static org.alfresco.rest.api.model.rules.InclusionType.OWNED;
import java.util.List;
import java.util.stream.Collectors;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.rest.api.model.rules.RuleSet;
@@ -93,12 +92,7 @@ public class RuleSetLoader
}
if (includes.contains(LINKED_TO_BY))
{
List<NodeRef> linkedToBy = nodeService.getParentAssocs(ruleSetNodeRef)
.stream()
.map(ChildAssociationRef::getParentRef)
.filter(folder -> !folder.equals(parentRef))
.collect(Collectors.toList());
ruleSet.setLinkedToBy(linkedToBy);
ruleSet.setLinkedToBy(loadLinkedToBy(ruleSetNodeRef));
}
if (includes.contains(IS_INHERITED))
{
@@ -113,6 +107,11 @@ public class RuleSetLoader
return ruleService.getFoldersInheritingRuleSet(ruleSetNodeRef, MAX_INHERITED_BY_SIZE);
}
private List<NodeRef> loadLinkedToBy(NodeRef ruleSetNodeRef)
{
return ruleService.getFoldersLinkingToRuleSet(ruleSetNodeRef);
}
private boolean loadIsInherited(NodeRef ruleSetNodeRef)
{
return AuthenticationUtil.runAsSystem(() -> !ruleService.getFoldersInheritingRuleSet(ruleSetNodeRef, 1).isEmpty());