protected Set postedRestrictionsForPrivilege()

in src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java [494:529]


    protected Set<LocalRestriction> postedRestrictionsForPrivilege(
            @NotNull SlingHttpServletRequest request,
            @NotNull Map<String, RestrictionDefinition> srMap,
            @NotNull Privilege forPrivilege,
            @NotNull PrivilegeValues forAllowOrDeny,
            @NotNull Set<LocalRestriction> generalRestrictions) throws RepositoryException {
        Set<LocalRestriction> restrictions = new HashSet<>(generalRestrictions);

        @NotNull
        Map<String, Matcher> postedRestrictionParams = getMatchedRequestParameterNames(request, RESTRICTION_PATTERN);
        for (Entry<String, Matcher> entry : postedRestrictionParams.entrySet()) {
            String paramName = entry.getKey();
            Matcher matcher = entry.getValue();
            String privilegeName;
            String restrictionName;
            PrivilegeValues allowOrDeny;
            if (matcher.group(2) != null) {
                privilegeName = matcher.group(1);
                restrictionName = matcher.group(3);
                allowOrDeny = PrivilegeValues.valueOfParam(matcher.group(4));
            } else {
                privilegeName = null;
                restrictionName = matcher.group(1);
                allowOrDeny = null;
            }

            if ((privilegeName == null || forPrivilege.getName().equals(privilegeName)) &&
                    (allowOrDeny == null || forAllowOrDeny.equals(allowOrDeny))) {
                LocalRestriction localRestriction = toLocalRestriction(request, srMap, restrictionName, paramName);
                restrictions.removeIf(r -> r.getName().equals(localRestriction.getName()));
                restrictions.add(localRestriction);
            }
        }

        return restrictions;
    }