public void visitSetAclPaths()

in src/main/java/org/apache/sling/feature/cpconverter/repoinit/AccessControlVisitor.java [95:123]


    public void visitSetAclPaths(SetAclPaths setAclPaths) {
        List<AclLine> lines = new ArrayList<>();
        for (AclLine line : setAclPaths.getLines()) {
            List<String> principalNames = new ArrayList<>(line.getProperty(AclLine.PROP_PRINCIPALS));
            if (!isRemoveAction(line)) {
                for (String principalName : line.getProperty(AclLine.PROP_PRINCIPALS)) {
                    if (enforcePrincipalBased(principalName)) {
                        AclLine newLine = createAclLine(line, null, setAclPaths.getPaths());
                        toConvert.put(principalName, setAclPaths.getOptions(), newLine);
                        principalNames.remove(principalName);
                    }
                }
            }

            if (principalNames.equals(line.getProperty(AclLine.PROP_PRINCIPALS))) {
                // nothing to convert -> use the original line
                lines.add(line);
            } else if (!principalNames.isEmpty()) {
                // re-create modified ACLLine without the principals that will be converted
                AclLine modified = createAclLine(line, principalNames, null);
                lines.add(modified);
            }
        }

        if (!lines.isEmpty()) {
            SetAclPaths operation = new SetAclPaths(setAclPaths.getPaths(), lines, setAclPaths.getOptions());
            formatter.format("%s", operation.asRepoInitString());
        }
    }