Skip to main content

ConfiguredCeiling

Struct ConfiguredCeiling 

Source
pub struct ConfiguredCeiling(ScopeSet);
Expand description

The ceiling an operator wrote down, applied to every agent and every client alike.

plan/scope-policy.md’s “from server configuration first”: an enumeration of scope atoms, not a pattern, read out of didbot_config::sections::OAuthSection::scope_ceiling. Per-agent and per-client profiles are the operator’s repository’s to hold, and this ignores both arguments until that exists.

A seam, not a destination. plan/policy-store.md’s ceiling — read from policy records in the operator’s repository, per agent and per client — implements this same ScopePolicy trait and replaces this implementation whole when it lands; nothing that calls a ceiling has to change for it. What it needs first is an account on didbot_policy::Subject::Grant, which is what a per-account rule would have to match on.

It can only narrow. ConfiguredCeiling::new intersects what it was given with GrantAnyScope’s own ceiling and keeps the overlap, so a configured atom outside the compiled-in ceiling — anything in plan/scope-policy.md’s hard-blocked set, or a kind: a later grammar adds — grants nothing however it is spelled in the file. That is what lets a scope live in a configuration file at all; see didbot_config’s own crate doc.

Tuple Fields§

§0: ScopeSet

Implementations§

Source§

impl ConfiguredCeiling

Source

pub fn new<'a>(atoms: impl IntoIterator<Item = &'a str>) -> (Self, DroppedAtoms)

Builds a ceiling from the atoms an operator enumerated, dropping every one the compiled-in ceiling does not already admit.

An atom is kept only if the compiled-in ceiling admits it whole. A partial admission is dropped rather than kept at its projection: transition:generic overlaps repo:* rpc:*, and an operator who wrote a hard-blocked atom should get nothing for it rather than the slice of it that happens to fall inside. An atom that does not parse is dropped for the same reason — this runs at startup, and a ceiling that fails closed on the atoms it understood is the safe reading of a file it only half understands. The dropped atoms are returned so the caller can log them.

Bounded at crate::oauth::scope::MAX_SCOPE_ATOMS. ScopeSet::new compares every pair of atoms it is handed, and that constant is what bounds the comparison — which it does for ScopeSet::parse, applied per string, but each configured atom is parsed on its own here and the results accumulate. Without this a configuration file naming a few thousand atoms is a few million comparisons at boot.

Source

pub fn scopes(&self) -> &ScopeSet

What this ceiling admits, for a caller that wants to log or show it.

Trait Implementations§

Source§

impl Clone for ConfiguredCeiling

Source§

fn clone(&self) -> ConfiguredCeiling

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ConfiguredCeiling

Source§

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

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

impl ScopePolicy for ConfiguredCeiling

Source§

fn ceiling(&self, _did: &str, _client_id: &str) -> ScopeSet

The most this did may ever hold from client_id. A ceiling only ever shrinks from GrantAnyScope’s; an empty ScopeSet refuses every non-empty request. Both arguments are ignored by every implementation here — see the module doc.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,