pub enum TokenScope {
Full,
Write,
ReadOnly,
McpOnly,
}Expand description
What a personal access token may do with the rights of its user.
Variants§
Full
Everything the user may do: read, write and approve (REST and MCP). Every token created before scopes existed, and the desktop app’s tokens, have it, so nothing changes for them.
Write
Read and write, but not approve: a change order cannot be reviewed (approved or rejected, which releases it), a change request cannot be decided and a revision cannot be made obsolete. For integrations that create and edit data but must not release it.
ReadOnly
Only reads: GET/HEAD requests and the read-only MCP tools.
McpOnly
Only the MCP endpoint (POST /api/v1/mcp), with all its tools.
Implementations§
Source§impl TokenScope
impl TokenScope
pub const ALL: [TokenScope; 4]
pub fn as_str(self) -> &'static str
Sourcepub fn parse(s: &str) -> Option<TokenScope>
pub fn parse(s: &str) -> Option<TokenScope>
Accepts the stored names and their spellings with a dash.
pub fn label(self) -> &'static str
Sourcepub fn allows_request(self, method: &str, path: &str) -> bool
pub fn allows_request(self, method: &str, path: &str) -> bool
Whether a request with this HTTP method to this path (the full path,
e.g. /api/v1/items) is within the scope. A read_only token may
post to the MCP endpoint; which tools it may call is checked there
(TokenScope::allows_tool).
Sourcepub fn allows_tool(self, read_only: bool) -> bool
pub fn allows_tool(self, read_only: bool) -> bool
Whether an MCP tool may be called (read_only = the tool only reads).
Trait Implementations§
Source§impl Clone for TokenScope
impl Clone for TokenScope
impl Copy for TokenScope
Source§impl Debug for TokenScope
impl Debug for TokenScope
Source§impl Default for TokenScope
impl Default for TokenScope
Source§impl<'de> Deserialize<'de> for TokenScope
impl<'de> Deserialize<'de> for TokenScope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TokenScope
Source§impl Hash for TokenScope
impl Hash for TokenScope
Source§impl PartialEq for TokenScope
impl PartialEq for TokenScope
Source§impl Serialize for TokenScope
impl Serialize for TokenScope
impl StructuralPartialEq for TokenScope
Auto Trait Implementations§
impl Freeze for TokenScope
impl RefUnwindSafe for TokenScope
impl Send for TokenScope
impl Sync for TokenScope
impl Unpin for TokenScope
impl UnsafeUnpin for TokenScope
impl UnwindSafe for TokenScope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§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 moreimpl<T> Parallelizable for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.