Enum Class Guard.Decision

java.lang.Object
java.lang.Enum<Guard.Decision>
ch.tocco.nice2.security.api.Guard.Decision
All Implemented Interfaces:
Serializable, Comparable<Guard.Decision>, Constable
Enclosing interface:
Guard

public static enum Guard.Decision extends Enum<Guard.Decision>
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.
  • Enum Constant Details

    • NO_RULE

      public static final Guard.Decision NO_RULE
      No rule matched the permission.
    • DENY_RULE

      public static final Guard.Decision DENY_RULE
      The permission was explicitly denied by a rule.
    • GRANT_RULE

      public static final Guard.Decision GRANT_RULE
      The permission was explicitly granted by a rule.
    • PRIVILEGED

      public static final Guard.Decision PRIVILEGED
      The permission was granted because we're in privileged mode.
  • Method Details

    • values

      public static Guard.Decision[] 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 Guard.Decision 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
    • granted

      public boolean granted()
      Returns true if this evaluation result grants the permission.
      Returns:
      true if the permission is granted.
    • grantable

      public boolean grantable()
      Returns true if combine() may return a decision where granted() returns true.
      Returns:
      true if the final yes/no decision may still be "yes".
    • combine

      public abstract Guard.Decision combine(Guard.Decision that)
      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.