Record Class PermissionDefinition
java.lang.Object
java.lang.Record
fr.fidorial.permission.PermissionDefinition
public record PermissionDefinition(PermissionNode node, String description, TriState regularDefault, TriState operatorDefault)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionPermissionDefinition(PermissionNode node, String description, TriState regularDefault, TriState operatorDefault) Creates an instance of aPermissionDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondefaultFor(boolean operator) Returns the default state for a holder.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.static PermissionDefinitionDeclares a permission everyone holds by default.static PermissionDefinitionexplicitOnly(String node, String description) Declares a permission nobody holds by default, operators included.final inthashCode()Returns a hash code value for this object.node()Returns the value of thenoderecord component.Returns the value of theoperatorDefaultrecord component.static PermissionDefinitionoperatorOnly(String node, String description) Declares a permission only operators hold by default.static PermissionDefinitionDeclares a permission that is actively refused unless a grant overrides it.Returns the value of theregularDefaultrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PermissionDefinition
public PermissionDefinition(PermissionNode node, String description, TriState regularDefault, TriState operatorDefault) Creates an instance of aPermissionDefinitionrecord class.- Parameters:
node- the value for thenoderecord componentdescription- the value for thedescriptionrecord componentregularDefault- the value for theregularDefaultrecord componentoperatorDefault- the value for theoperatorDefaultrecord component
-
-
Method Details
-
operatorOnly
Declares a permission only operators hold by default.- Parameters:
node- node pathdescription- description- Returns:
- the definition
-
everyone
Declares a permission everyone holds by default.- Parameters:
node- node pathdescription- description- Returns:
- the definition
-
explicitOnly
Declares a permission nobody holds by default, operators included. It has to be granted explicitly through aPermissionGrantor an externalPermissionResolver.- Parameters:
node- node pathdescription- description- Returns:
- the definition
-
refused
Declares a permission that is actively refused unless a grant overrides it.- Parameters:
node- node pathdescription- description- Returns:
- the definition
-
defaultFor
Returns the default state for a holder.- Parameters:
operator- whether the holder is an operator- Returns:
- the applicable default
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
node
Returns the value of thenoderecord component.- Returns:
- the value of the
noderecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
regularDefault
Returns the value of theregularDefaultrecord component.- Returns:
- the value of the
regularDefaultrecord component
-
operatorDefault
Returns the value of theoperatorDefaultrecord component.- Returns:
- the value of the
operatorDefaultrecord component
-