Class PrivilegeBitsProvider

java.lang.Object
org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeBitsProvider
All Implemented Interfaces:
PrivilegeConstants

public final class PrivilegeBitsProvider extends Object implements PrivilegeConstants
Allows to obtain the internal representation of privileges (or their names) and to covert the internal representation back to privilege names.
  • Constructor Details

    • PrivilegeBitsProvider

      public PrivilegeBitsProvider(org.apache.jackrabbit.oak.api.Root root)
  • Method Details

    • getPrivilegesTree

      @NotNull public @NotNull org.apache.jackrabbit.oak.api.Tree getPrivilegesTree()
      Returns the root tree for all privilege definitions stored in the content repository.
      Returns:
      The privileges root.
    • getBits

      @NotNull public @NotNull PrivilegeBits getBits(@NotNull @NotNull String... privilegeNames)
      Returns the bits for the given privilege names.
      Parameters:
      privilegeNames - the names
      Returns:
      the privilege bits representing the given privilege names.
    • getBits

      @NotNull public @NotNull PrivilegeBits getBits(@NotNull @NotNull Iterable<String> privilegeNames)
      Returns the bits for the given privilege names. Note, that any invalid privilege names will be ignored.
      Parameters:
      privilegeNames - the names
      Returns:
      the privilege bits representing the given privilege names.
    • getBits

      @NotNull public @NotNull PrivilegeBits getBits(@NotNull @NotNull Iterable<String> privilegeNames, boolean validateNames) throws AccessControlException
      Returns the bits for the given privilege names with the option to verify that all privilege names point to a valid, registered privilege.
      Parameters:
      privilegeNames - An iterable of privilege names.
      validateNames - If set to true this method will throw an AccessControlException if an invalid privilege name is found (i.e. one that doesn't represent a registered privilege). If set to false invalid privilege names will be ignored i.e. making this method equivalent to getBits(String...).
      Returns:
      the privilege bits representing the given privilege names.
      Throws:
      AccessControlException - If validateNames is true and the any of the specified privilege names is invalid.
    • getBits

      @NotNull public @NotNull PrivilegeBits getBits(@NotNull @NotNull Privilege[] privileges, @NotNull @NotNull org.apache.jackrabbit.oak.namepath.NameMapper nameMapper)
      Returns the bits for the given array of privileges.
      Parameters:
      privileges - An array of privileges
      nameMapper - the name mapper
      Returns:
      the privilege bits representing the given array of privileges.
    • getPrivilegeNames

      @NotNull public @NotNull Set<String> getPrivilegeNames(@Nullable @Nullable PrivilegeBits privilegeBits)
      Resolve the given privilege bits to the corresponding set of privilege names.
      Parameters:
      privilegeBits - An instance of privilege bits.
      Returns:
      The names of the registered privileges associated with the given bits. Any bits that don't have a corresponding privilege definition will be ignored.
    • getAggregatedPrivilegeNames

      @NotNull public @NotNull Iterable<String> getAggregatedPrivilegeNames(@NotNull @NotNull String... privilegeNames)
      Return the names of the non-aggregate privilege names corresponding to the specified privilegeNames.
      Parameters:
      privilegeNames - The privilege names to be converted.
      Returns:
      The names of the non-aggregate privileges that correspond to the given privilegeNames.