Skip to main content

ResolvedGrants

Struct ResolvedGrants 

#[non_exhaustive]
pub struct ResolvedGrants { pub admin: bool, pub allowed_agents: Vec<AgentAlias>, pub config_write_paths: Vec<String>, pub allowed_tools: Vec<String>, pub resources: BTreeMap<Resource, BTreeSet<Verb>>, }
Expand description

The merged authorization result for one principal: what it may touch and how. Produced by the shared grant resolver from permission profiles at a specific authorization-policy generation; consumed by dispatch classification, the gateway router, and deep resource checks. Never stored on a Principal — consumers re-resolve when the generation changes.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§admin: bool

Full access to everything. Short-circuits all other checks. An explicit administrator grant dominates the ordinary grant set.

§allowed_agents: Vec<AgentAlias>

Agent aliases this principal may bind or address. Empty = none; broad access requires the explicit WILDCARD entry.

§config_write_paths: Vec<String>

Dotted config path prefixes this principal may write. A trailing .* grants the subtree; a bare path grants that exact prop; the WILDCARD entry grants every path. Empty = none.

§allowed_tools: Vec<String>

Tool names this principal may cause an agent to run. Empty = none; broad access requires the explicit WILDCARD entry. (The agent’s own tool policy still applies on top.)

§resources: BTreeMap<Resource, BTreeSet<Verb>>

Resource-class grants: which verbs are permitted per resource. Missing resource = deny.

Implementations§

Source§

impl ResolvedGrants

Source

pub fn none() -> Self

The deny-everything grant set (the Default).

Source

pub fn all() -> Self

The allow-everything grant set (admin). Used for the shared-operator sentinel so legacy single-operator deployments keep today’s behaviour.

Source

pub fn permits(&self, resource: Resource, verb: Verb) -> bool

Whether this grant set permits verb on resource.

Source

pub fn may_use_agent(&self, alias: &str) -> bool

Whether this principal may bind or address the given agent alias. An empty selector list grants no agents; broad access requires the explicit WILDCARD entry or admin.

Source

pub fn may_use_tool(&self, tool: &str) -> bool

Whether this principal may cause the named tool to run. An empty selector list grants no tools; broad access requires the explicit WILDCARD entry or admin.

Source

pub fn may_write_config(&self, path: &str) -> bool

Whether this principal may write the given dotted config path. A granted foo.* covers foo itself and every descendant; a granted bare foo.bar covers exactly that prop; the WILDCARD entry covers every path. Empty = none.

Source

pub fn merge(&mut self, other: &Self)

Merge another grant set into this one — the deterministic monotonic union used when one identity maps to multiple permission profiles. No implicit deny rules, no profile-order precedence; admin from either side dominates.

Trait Implementations§

Source§

impl Clone for ResolvedGrants

Source§

fn clone(&self) -> ResolvedGrants

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResolvedGrants

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResolvedGrants

Source§

fn default() -> ResolvedGrants

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ResolvedGrants

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ResolvedGrants

Source§

impl PartialEq for ResolvedGrants

Source§

fn eq(&self, other: &ResolvedGrants) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · §

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ResolvedGrants

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ResolvedGrants

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.