feat: add reporter role for SSO auto-provisioning
All checks were successful
CI Pipeline / Rust Format Check (push) Successful in 5s
CI Pipeline / Clippy Lints (push) Successful in 52s
CI Pipeline / Rust Unit Tests (push) Successful in 1m10s
CI Pipeline / Security Audit (push) Successful in 4s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 14s
CI Pipeline / Build .deb & Release (push) Has been skipped
All checks were successful
CI Pipeline / Rust Format Check (push) Successful in 5s
CI Pipeline / Clippy Lints (push) Successful in 52s
CI Pipeline / Rust Unit Tests (push) Successful in 1m10s
CI Pipeline / Security Audit (push) Successful in 4s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 14s
CI Pipeline / Build .deb & Release (push) Has been skipped
This commit is contained in:
@ -36,6 +36,7 @@ pub struct AuthUser {
|
||||
pub enum UserRole {
|
||||
Admin,
|
||||
Operator,
|
||||
Reporter,
|
||||
}
|
||||
|
||||
impl UserRole {
|
||||
@ -43,6 +44,7 @@ impl UserRole {
|
||||
match s {
|
||||
"admin" => Some(Self::Admin),
|
||||
"operator" => Some(Self::Operator),
|
||||
"reporter" => Some(Self::Reporter),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -51,6 +53,7 @@ impl UserRole {
|
||||
match self {
|
||||
Self::Admin => "admin",
|
||||
Self::Operator => "operator",
|
||||
Self::Reporter => "reporter",
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +61,11 @@ impl UserRole {
|
||||
pub fn is_admin(&self) -> bool {
|
||||
matches!(self, Self::Admin)
|
||||
}
|
||||
|
||||
/// Admin and Operator can write; Reporter is read-only.
|
||||
pub fn can_write(&self) -> bool {
|
||||
matches!(self, Self::Admin | Self::Operator)
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared auth configuration injected via Axum state.
|
||||
|
||||
Reference in New Issue
Block a user