Enum Class PushPrivilege

java.lang.Object
java.lang.Enum<PushPrivilege>
com.iizix.server.push.engine.http.PushPrivilege
All Implemented Interfaces:
Serializable, Comparable<PushPrivilege>, Constable

public enum PushPrivilege extends Enum<PushPrivilege>
The four privileges of PUSH-WIRE-CONTRACT.md section 4, and the built-in group definitions of PUSH-CREDENTIALS.md section 6 that apply while no credentials file is configured - the complete configured-nothing state this tree is in.

A privilege is granted by a group; a user holds the union of its groups' privileges. Group names are compared in English lower case, as the database compares them (IZS.GROUPS.name_lower). A database group with no definition grants nothing.

Author:
Christopher Mindus
  • Enum Constant Details

    • SEND

      public static final PushPrivilege SEND
      Grants push.
    • QUERY

      public static final PushPrivilege QUERY
      Grants count, list and subscriptions.
    • SUBSCRIBE

      public static final PushPrivilege SUBSCRIBE
      Grants subscribe, unsubscribe and reset of the caller's own device.
    • ADMIN

      public static final PushPrivilege ADMIN
      Grants reset of another user or device.
  • Field Details

  • Method Details

    • values

      public static PushPrivilege[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PushPrivilege valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static PushPrivilege parse(String name)
      Parses a privilege name as the credentials file writes it: send, query, subscribe or admin, in any case.
      Parameters:
      name - The name, may be null.
      Returns:
      The privilege, or null for anything else - the closed set admits no other name.
    • builtIn

      public static Set<PushPrivilege> builtIn(String groupName, boolean development)
      Gets the privileges one group grants under the built-in definitions.
      Parameters:
      groupName - The group name, in any case.
      development - true on a development server, where default also gets SEND.
      Returns:
      The privileges, empty for a group with no definition; never null.
    • builtIn

      public static Set<PushPrivilege> builtIn(Collection<String> groupNames, boolean development)
      Gets the union of the privileges a user's groups grant under the built-in definitions.
      Parameters:
      groupNames - The names of the user's enabled groups, in any case.
      development - true on a development server.
      Returns:
      The privileges, never null.