Enum Class PushPrivilege
- All Implemented Interfaces:
Serializable, Comparable<PushPrivilege>, Constable
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
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E>Enum Constant Summary
Enum ConstantsField Summary
FieldsMethod Summary
Modifier and TypeMethodDescriptionstatic Set<PushPrivilege> Gets the privileges one group grants under the built-in definitions.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.static PushPrivilegeParses a privilege name as the credentials file writes it:send,query,subscribeoradmin, in any case.static PushPrivilegeReturns the enum constant of this class with the specified name.static PushPrivilege[]values()Returns an array containing the constants of this enum class, in the order they are declared.
Enum Constant Details
SEND
Grantspush.QUERY
Grantscount,listandsubscriptions.SUBSCRIBE
Grantssubscribe,unsubscribeandresetof the caller's own device.ADMIN
Grantsresetof another user or device.
Field Details
GROUP_ADMINISTRATORS
The built-in group that gets every privilege.- See Also:
GROUP_DEFAULT
Method Details
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
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 nameNullPointerException- if the argument is null
parse
Parses a privilege name as the credentials file writes it:send,query,subscribeoradmin, 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
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, wheredefaultalso getsSEND.- Returns:
- The privileges, empty for a group with no definition; never null.
builtIn
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.