Class PrivilegeUtil

  • All Implemented Interfaces:
    PrivilegeConstants

    public final class PrivilegeUtil
    extends java.lang.Object
    implements PrivilegeConstants
    Privilege management related utility methods.
    • Method Detail

      • getPrivilegesTree

        @NotNull
        public static @NotNull Tree getPrivilegesTree​(@NotNull
                                                      @NotNull Root root)
        Returns the root tree for all privilege definitions stored in the content repository.
        Returns:
        The privileges root.
      • readDefinition

        @NotNull
        public static @NotNull PrivilegeDefinition readDefinition​(@NotNull
                                                                  @NotNull Tree definitionTree)
        Reads the privilege definition stored in the specified definition tree. Note, that this utility does not check the existence nor the node type of the specified tree.
        Parameters:
        definitionTree - An existing tree storing a privilege definition.
        Returns:
        A new instance of PrivilegeDefinition.
      • getOakNames

        @NotNull
        public static @NotNull java.util.Set<java.lang.String> getOakNames​(@Nullable
                                                                           @Nullable java.lang.String[] jcrNames,
                                                                           @NotNull
                                                                           @NotNull NamePathMapper namePathMapper)
                                                                    throws AccessControlException
        Convert the given JCR privilege names to Oak names.
        Parameters:
        jcrNames - The JCR names of privileges
        namePathMapper - The NamePathMapper to use for the conversion.
        Returns:
        A set of Oak names
        Throws:
        AccessControlException - If the given JCR names cannot be converted.
      • getOakName

        @NotNull
        public static @NotNull java.lang.String getOakName​(@Nullable
                                                           @Nullable java.lang.String jcrName,
                                                           @NotNull
                                                           @NotNull NamePathMapper namePathMapper)
                                                    throws AccessControlException
        Convert the given JCR privilege name to an Oak name.
        Parameters:
        jcrName - The JCR name of a privilege.
        namePathMapper - The NamePathMapper to use for the conversion.
        Returns:
        the Oak name of the given privilege.
        Throws:
        AccessControlException - If the specified name is null or cannot be resolved to an Oak name.