Class KeyPermissions

java.lang.Object
io.deephaven.kv.KeyPermissions

public final class KeyPermissions extends Object
An immutable collection of non-overlapping read and write permissions, as represented by key prefix sets.

The permissions are currently inclusive-only - ie, it's not currently possible to explicitly exclude permissions. We may choose to model this in the future with a KeyPrefixSet for readExclusions and writeExclusions.

  • Constructor Details

    • KeyPermissions

      public KeyPermissions(@NotNull @NotNull KeyPrefixSet reads, @NotNull @NotNull KeyPrefixSet writes)
      Parameters:
      reads - the read permissions
      writes - the write permissions
  • Method Details

    • unlimited

      public static KeyPermissions unlimited()
      Returns:
      the unlimited permissions, which represents all read and write permissions
    • none

      public static KeyPermissions none()
      Returns:
      the none permissions, which represents no read and write permissions
    • r

      public static KeyPermissions r(KeyPath... prefixes)
      A helper to create read-only permissions from the given prefixes
    • rw

      public static KeyPermissions rw(KeyPath... prefixes)
      A helper to create mirrored read/write permissions from the given prefixes
    • getPrefixedReadPermissions

      public KeyPrefixSet getPrefixedReadPermissions()
      These are the key prefixes that the role has/needs read access to.
    • getPrefixedWritePermissions

      public KeyPrefixSet getPrefixedWritePermissions()
      These are the key prefixes that the role has/needs write access to.
    • contains

      public boolean contains(KeyPermissions permissions)
      Returns:
      true iff the current permissions are at least as permissive as the passed in permissions
    • union

      public KeyPermissions union(KeyPermissions other)
      Parameters:
      other - the other permissions
      Returns:
      the combined permissions, representing the union of this permissions and other
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object