pub enum ActScope {
None,
All,
Contexts(Vec<String>),
}Expand description
A DID’s authority to confer access through an approval, re-exported from the SDK.
The type lives in vta-sdk because the DIDComm and Trust Task update
bodies carry it and must be constructible by clients that never link the
server crates. Only the shape is shared — every authorization rule over
it (validate_approve_scope_grant below) stays here. Same arrangement as
crate::context_path.
A DID’s authority to act — the contexts in which it may make a change.
The sibling axis to ApproveScope, with deliberately identical variants,
an identical covers predicate, and the same
fail-closed None default.
§Why this exists
Unlike ApproveScope, this is not a stored or wire field. The act
axis is stored as (role, allowed_contexts), where an empty
allowed_contexts means opposite things depending on the role: unrestricted
for an admin (that is how a super-admin is spelled), and nothing at all
for every other role. Reading the raw field without the role is therefore a
bug, and has repeatedly been one — a display that called a least-privilege
approver (unrestricted), two acl list --context filters that disagreed
on whether an empty list matches every context or none, and a vault scope
gate that granted cross-context reads to an entry authorized nowhere.
This type makes the three cases distinguishable so that decode happens in
one place instead of at every call site. The decode itself is server-side
(vti_common::acl::act_scope_for), because it needs Role; only the shape
and the predicate are shared, exactly as for ApproveScope.
It lives beside ApproveScope so the two axes — what a DID may do and
what it may confer — read as one model rather than an enum and a
convention.
Variants§
None
Authorized in no context at all (the fail-closed default). The shape of
a least-privilege approver: acts nowhere, may still confer via its
ApproveScope.
All
Authorized in every context. Combined with the admin role this is a super-admin.
Contexts(Vec<String>)
Authorized in these contexts and their subtrees, and only these.
Implementations§
Source§impl ActScope
impl ActScope
Sourcepub fn covers(&self, context_id: &str) -> bool
pub fn covers(&self, context_id: &str) -> bool
Whether a holder of this scope may act in context_id.
Segment-aware ancestry, identical to ApproveScope::covers, so
authority over a parent context covers its whole subtree.
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
Whether this scope authorizes every context (the super-admin condition when paired with the admin role).
Sourcepub fn acts_nowhere(&self) -> bool
pub fn acts_nowhere(&self) -> bool
Whether this scope authorizes nothing.
Sourcepub fn named_contexts(&self) -> &[String]
pub fn named_contexts(&self) -> &[String]
Trait Implementations§
Source§impl Display for ActScope
impl Display for ActScope
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Operator-facing rendering. The unrestricted and acts-nowhere cases are
spelled out rather than both collapsing to (unrestricted), which is
what made them indistinguishable on ACL displays. The wording matches
what vta-cli-common’s format_contexts already prints.
impl Eq for ActScope
impl StructuralPartialEq for ActScope
Auto Trait Implementations§
impl Freeze for ActScope
impl RefUnwindSafe for ActScope
impl Send for ActScope
impl Sync for ActScope
impl Unpin for ActScope
impl UnsafeUnpin for ActScope
impl UnwindSafe for ActScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
Source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.