pub enum PolicyOutcome {
Found(AclDocument),
Missing,
Invalid {
policy_path: String,
reason: InvalidPolicyReason,
},
Unavailable {
policy_path: String,
detail: String,
},
}Expand description
The terminal result of resolving the effective policy for a resource.
See the module docs for the handling contract. The key invariant:
only Missing may inherit.
Variants§
Found(AclDocument)
A policy document was located and parsed. inherited on the document
records whether it came from an ancestor container.
Missing
No policy exists at the resource or at any ancestor up to the root.
This is absence, not failure: the walk completed and found nothing. The evaluator still denies by default (no ACL grants nothing), but the resolution itself succeeded.
Invalid
A policy document exists at policy_path but could not be parsed.
Deny. Never inherit past it.
Fields
reason: InvalidPolicyReasonWhy the parse failed.
The backend could not be read at policy_path.
Deny or surface an error. Never inherit past it — the policy’s content is unknown, so no grant can be justified from an ancestor.
Implementations§
Source§impl PolicyOutcome
impl PolicyOutcome
Sourcepub fn document(&self) -> Option<&AclDocument>
pub fn document(&self) -> Option<&AclDocument>
The parsed document, if one was found.
Returns None for every non-Found outcome — including the failure
outcomes. Callers that feed this straight into the evaluator get
deny-by-default, but they lose the distinction between “nothing governs
this” and “we could not read what governs this”; prefer matching on the
outcome directly, or gate on Self::is_failure first.
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
true for Invalid and Unavailable
— the outcomes that must deny rather than inherit.
Sourcepub fn may_inherit(&self) -> bool
pub fn may_inherit(&self) -> bool
true when the walk may legitimately fall back to an ancestor or legacy
policy — i.e. only for Missing.
Sourcepub fn into_result(self) -> Result<Option<AclDocument>, PodError>
pub fn into_result(self) -> Result<Option<AclDocument>, PodError>
Collapse to the historical Result<Option<AclDocument>, PodError> shape.
Found → Ok(Some), Missing → Ok(None), and both failure outcomes
→ Err. The error mapping keeps the HTTP status the bounded parsers
already produced (413 for TooLarge, 400 for TooDeep) so existing
callers see no status change; Malformed / NotUtf8 become
PodError::AclParse and Unavailable becomes PodError::Backend.
This is a lossy but fail-closed adapter: an Err can never be
mistaken for a grant. New code should match on the outcome instead.
Sourcepub fn from_legacy(
result: Result<Option<AclDocument>, PodError>,
resource_path: &str,
) -> Self
pub fn from_legacy( result: Result<Option<AclDocument>, PodError>, resource_path: &str, ) -> Self
Adapt a legacy Result<Option<AclDocument>, PodError> into a typed
outcome.
Used as the default AclResolver::resolve_policy body so an existing
out-of-repo implementor that only supplies find_effective_acl keeps
compiling and still reports fail-closed outcomes. The mapping is the
inverse of Self::into_result; it cannot recover which ancestor a
legacy resolver skipped, so such an implementor should override
resolve_policy to get true per-level fidelity.