User profile and admin privileges

This commit is contained in:
Alphonse Paix
2025-10-01 01:17:59 +02:00
parent 3e81c27ab3
commit 402c560354
22 changed files with 467 additions and 43 deletions

View File

@@ -1,3 +1,5 @@
use std::fmt::Display;
use crate::telemetry::spawn_blocking_with_tracing;
use anyhow::Context;
use argon2::{
@@ -138,6 +140,15 @@ pub enum Role {
Writer,
}
impl Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Role::Admin => write!(f, "admin"),
Role::Writer => write!(f, "writer"),
}
}
}
#[derive(Clone)]
pub struct AuthenticatedUser {
pub user_id: Uuid,