pub struct Claims {
pub sub: String,
pub email: String,
pub role: String,
pub organization_id: Option<Uuid>,
pub role_id: Option<Uuid>,
pub exp: i64,
pub iat: i64,
}Fields§
§sub: String§email: String§role: String§organization_id: Option<Uuid>§role_id: Option<Uuid>§exp: i64§iat: i64Implementations§
Source§impl Claims
impl Claims
Sourcepub fn is_superadmin(&self) -> bool
pub fn is_superadmin(&self) -> bool
L’appelant est-il superadministrateur de la plateforme ?
Même définition que AuthenticatedUser::is_superadmin, et pour la même
raison : la comparaison littérale role == "superadmin" était écrite à
la main en soixante-treize endroits. Une seule d’entre elles qui se
trompe de casse, ou qui survit au renommage du rôle, ouvre un accès
sans que rien ne le dise.
C’est la faiblesse qui a produit #814 — community-moderator comparé à
community.moderator, un trait d’union contre un point — et #836, où
dix rôles sur quatorze étaient travestis en owner faute d’être
déclarés au même endroit.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Claims
impl<'de> Deserialize<'de> for Claims
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Claims
impl RefUnwindSafe for Claims
impl Send for Claims
impl Sync for Claims
impl Unpin for Claims
impl UnsafeUnpin for Claims
impl UnwindSafe for Claims
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
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<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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 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>
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 moreCreates a shared type from an unshared type.