Package ch.tocco.nice2.security.api
Enum Class Guard.Decision
- All Implemented Interfaces:
Serializable
,Comparable<Guard.Decision>
,Constable
- Enclosing interface:
Guard
The result of a permission evaluation. Provides some more information about *why*
an action is allowed or not. Specifically, it allows to determine whether a
permission is denied explicitly or implicitly because no rule matched.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe permission was explicitly denied by a rule.The permission was explicitly granted by a rule.No rule matched the permission.The permission was granted because we're in privileged mode. -
Method Summary
Modifier and TypeMethodDescriptionabstract Guard.Decision
combine
(Guard.Decision that) Combines the decision with another decision.boolean
boolean
granted()
Returnstrue
if this evaluation result grants the permission.static Guard.Decision
Returns the enum constant of this class with the specified name.static Guard.Decision[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO_RULE
No rule matched the permission. -
DENY_RULE
The permission was explicitly denied by a rule. -
GRANT_RULE
The permission was explicitly granted by a rule. -
PRIVILEGED
The permission was granted because we're in privileged mode.
-
-
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
-
granted
public boolean granted()Returnstrue
if this evaluation result grants the permission.- Returns:
true
if the permission is granted.
-
grantable
public boolean grantable()- Returns:
true
if the final yes/no decision may still be "yes".
-
combine
Combines the decision with another decision. This table shows how decisions will be combined:| that | no rule | deny | grant | |-------------|---------|-------|-------| | **no rule** | no rule | deny | grant | | **deny** | deny | deny | deny | | **grant** | grant | deny | grant |
- Parameters:
that
- The decision to combine this decision with.- Returns:
- The combined decision.
-