pub struct AuthContext {
pub user: String,
pub permissions: Vec<Permission>,
pub token_id: String,
pub scope: TokenScope,
}Fields§
§user: String§permissions: Vec<Permission>§token_id: String§scope: TokenScopeImplementations§
Source§impl AuthContext
impl AuthContext
pub fn has_permission(&self, perm: Permission) -> bool
pub fn can_read(&self) -> bool
pub fn can_write(&self) -> bool
pub fn can_push(&self) -> bool
pub fn is_admin(&self) -> bool
pub fn can_access_repo(&self, repo: &str) -> bool
Sourcepub fn can_access_namespace(&self, namespace: &str) -> bool
pub fn can_access_namespace(&self, namespace: &str) -> bool
Whether this context may access namespace.
NamespaceTree(scope) grants access downward only: the scope
namespace itself and any descendant (scope/...). It deliberately does
NOT grant upward access — a token scoped to a child namespace cannot
reach its parent or ancestors. This mirrors Self::can_access_repo.
Containment is segment-aware via scope_contains: candidates with
./../empty segments are denied outright (no check-then-normalize
bypass).
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthContext
impl RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin for AuthContext
impl UnsafeUnpin for AuthContext
impl UnwindSafe for AuthContext
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
Mutably borrows from an owned value. Read more