Skip to main content

Module command_policy

Module command_policy 

Source
Expand description

Visibility and access-policy evaluation for commands. Runtime command visibility and access policy evaluation.

This module exists to answer two related questions consistently: should a command be shown, and may the current caller run it? Command metadata can carry coarse auth requirements, but this module owns the normalized runtime evaluation rules.

In broad terms:

Contract:

  • this module owns normalized policy evaluation, not command metadata shape
  • visibility and runnability are distinct outcomes and should stay distinct
  • callers should rely on the returned crate::core::command_policy::CommandAccess instead of re-deriving access rules ad hoc

Public API shape:

Structs§

CommandAccess
Effective access decision for a command under a specific context.
CommandPath
Normalized command path used as the lookup key for policy evaluation.
CommandPolicy
Declarative policy used to decide whether a command is visible and runnable.
CommandPolicyContext
Runtime facts used to evaluate a command policy.
CommandPolicyOverride
Partial override applied on top of a registered CommandPolicy.
CommandPolicyRegistry
Registry of command policies and per-path overrides.

Enums§

AccessReason
Reason codes attached to denied or hidden command access.
CommandAvailability
Product-level availability state for a command.
CommandRunnable
Runnable outcome produced by policy evaluation.
CommandVisibility
Visibility outcome produced by policy evaluation.
VisibilityMode
Visibility contract applied before runtime capability checks.

Functions§

evaluate_policy
Evaluates a single policy against the supplied runtime context.