pub enum ToolRequirement {
ActionOnResource(Action, Resource),
CourseMaterial(Uuid),
}Expand description
One check a tool’s caller must pass. A tool lists every resource its call touches; all of them must pass, so a call naming both a user and a course is authorized for both.
Variants§
ActionOnResource(Action, Resource)
The ordinary application check, exactly as a controller would make it.
CourseMaterial(Uuid)
Access to a course’s material, as authorize_access_to_course_material decides it: draft
state, joinability and anonymous access included. Not expressible as an action on a
resource, which is why it is its own variant.
Implementations§
Source§impl ToolRequirement
impl ToolRequirement
Sourcepub fn on_course(action: Action, course_id: Uuid) -> Self
pub fn on_course(action: Action, course_id: Uuid) -> Self
A check against the course the call names.
Sourcepub fn on_user(action: Action, user_id: Uuid) -> Self
pub fn on_user(action: Action, user_id: Uuid) -> Self
A check against the user the call targets. Only a global role can hold anything on a user, so this is a global capability that names its target rather than a per-user rule.
Sourcepub fn on_turn(action: Action, user_context: &ChatbotTurnContext) -> Self
pub fn on_turn(action: Action, user_context: &ChatbotTurnContext) -> Self
A check against the turn itself, for deciding what to offer the LLM before any call has named a target: the chatbot’s own course, or global permissions when it has none.
Trait Implementations§
Source§impl Clone for ToolRequirement
impl Clone for ToolRequirement
Source§fn clone(&self) -> ToolRequirement
fn clone(&self) -> ToolRequirement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolRequirement
impl Debug for ToolRequirement
Source§impl PartialEq for ToolRequirement
impl PartialEq for ToolRequirement
impl StructuralPartialEq for ToolRequirement
Auto Trait Implementations§
impl Freeze for ToolRequirement
impl RefUnwindSafe for ToolRequirement
impl Send for ToolRequirement
impl Sync for ToolRequirement
impl Unpin for ToolRequirement
impl UnsafeUnpin for ToolRequirement
impl UnwindSafe for ToolRequirement
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].