pub struct Actor {
pub id: Uuid,
pub username: String,
pub display_name: String,
pub role: Role,
pub skin: String,
pub preferred_cad: String,
pub projects: Vec<Uuid>,
pub hidden_projects: Vec<Uuid>,
}Expand description
The authenticated user on whose behalf a request is executed.
Fields§
§id: Uuid§username: String§display_name: String§role: Role§skin: StringUI skin (see domain::SKINS).
preferred_cad: StringPreferred CAD program (a format family, see cadformat::families);
"" = show all files alike.
projects: Vec<Uuid>Project groups the user is a member of.
Restricted project groups the user is NOT a member of; always empty
for administrators. Never serialized: it names groups the user may
not know about. The SQL guards in services::access bind it.
Implementations§
Source§impl Actor
impl Actor
Sourcepub fn can_see_project(&self, project_id: Option<Uuid>) -> bool
pub fn can_see_project(&self, project_id: Option<Uuid>) -> bool
Whether the actor may read data of a project group (None = items
without a group, readable by everyone).
Sourcepub fn without_groups(self, groups: &[Uuid]) -> Actor
pub fn without_groups(self, groups: &[Uuid]) -> Actor
The same actor without the read rights to groups (an interface that
is switched off for them, see services::project_policy): they are
hidden like groups the user is no member of.
Sourcepub fn for_webhook(project_id: Option<Uuid>, restricted: &[Uuid]) -> Actor
pub fn for_webhook(project_id: Option<Uuid>, restricted: &[Uuid]) -> Actor
A webhook evaluated as a virtual reader: it sees its own group and
every internal group; a global webhook (project_id = None) sees
internal groups only. restricted = all restricted groups.
Sourcepub fn require(&self, min: Role) -> AppResult<()>
pub fn require(&self, min: Role) -> AppResult<()>
Fails with 403 Forbidden unless the actor has at least role min.
pub fn is_admin(&self) -> bool
Sourcepub fn can_edit_project(&self, project_id: Option<Uuid>) -> bool
pub fn can_edit_project(&self, project_id: Option<Uuid>) -> bool
Whether the actor may modify data of a project group. Admins may edit everything, CAD editors only the projects they are members of; items without a project (legacy data) are editable by every CAD editor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Actor
impl RefUnwindSafe for Actor
impl Send for Actor
impl Sync for Actor
impl Unpin for Actor
impl UnsafeUnpin for Actor
impl UnwindSafe for Actor
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<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.