protected void applyPrivilegeAndRestrictions()

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


    protected void applyPrivilegeAndRestrictions(
            @NotNull Map<Privilege, LocalPrivilege> privilegeToLocalPrivilegesMap,
            @NotNull Privilege p, 
            boolean allow, @NotNull Set<LocalRestriction> allowRestrictions,
            boolean deny, @NotNull Set<LocalRestriction> denyRestrictions) throws RepositoryException {
        if (allow) {
            // clear out the state that we are replacing
            PrivilegesHelper.unallowRestrictions(privilegeToLocalPrivilegesMap,
                    allowRestrictions.stream().map(LocalRestriction::getName).collect(Collectors.toSet()),
                    Collections.singleton(p));
        }
        if (deny) {
            // clear out the state that we are replacing
            PrivilegesHelper.undenyRestrictions(privilegeToLocalPrivilegesMap,
                    denyRestrictions.stream().map(LocalRestriction::getName).collect(Collectors.toSet()),
                    Collections.singleton(p));
        }
        if (allow && deny) {
            PrivilegesHelper.allowAndDeny(privilegeToLocalPrivilegesMap, 
                    allow, allowRestrictions, deny, denyRestrictions,
                    Collections.singleton(p));
        } else if (allow) {
            PrivilegesHelper.allow(privilegeToLocalPrivilegesMap, allowRestrictions, Collections.singleton(p));
        } else if (deny) {
            PrivilegesHelper.deny(privilegeToLocalPrivilegesMap, denyRestrictions, Collections.singleton(p));
        }
    }