pub enum Decision {
Allow {
reason: String,
},
Deny {
reason: String,
},
Indeterminate {
reason: String,
},
}Expand description
Result of an authorization policy evaluation.
Three-valued logic allows distinguishing between:
- Explicit allow (requirements met)
- Explicit deny (requirements violated)
- Cannot determine (missing information)
This is important for fail-safe behavior: Indeterminate should typically
be treated as Deny unless the policy explicitly allows pass-through.
Variants§
Allow
Authorization granted.
All requirements were checked and met. The action may proceed.
Deny
Authorization denied.
A specific requirement was violated. The action must not proceed.
Indeterminate
Cannot determine authorization.
Required information was missing or invalid. This is NOT the same
as Deny - it indicates the policy engine couldn’t make a decision.
Callers should typically treat this as Deny for fail-safe behavior.
Implementations§
Source§impl Decision
impl Decision
Sourcepub fn allow(reason: impl Into<String>) -> Self
pub fn allow(reason: impl Into<String>) -> Self
Create an Allow decision with the given reason.
Sourcepub fn indeterminate(reason: impl Into<String>) -> Self
pub fn indeterminate(reason: impl Into<String>) -> Self
Create an Indeterminate decision with the given reason.
Sourcepub fn is_allowed(&self) -> bool
pub fn is_allowed(&self) -> bool
Returns true if this is an Allow decision.
Sourcepub fn is_indeterminate(&self) -> bool
pub fn is_indeterminate(&self) -> bool
Returns true if this is an Indeterminate decision.
Sourcepub fn is_allowed_fail_safe(&self) -> bool
pub fn is_allowed_fail_safe(&self) -> bool
Treat Indeterminate as Deny for fail-safe behavior.
This is the recommended way to convert a Decision to a boolean in security-sensitive contexts.