session revoking, perm, DatabaseError (partially)

This commit is contained in:
2026-02-28 23:27:56 +01:00
parent 94dcc1816d
commit c8d15f8c6b
4 changed files with 45 additions and 4 deletions

View File

@@ -1,13 +1,15 @@
use crate::users::User;
use crate::{database::DatabaseError, users::User};
/// Infradmin and systemuser have all permissions.
pub enum Permission {
// All Users have the right to observe their own sessions
ListOthersSessions,
// All Users have the right to revoke their own sessions
RevokeOthersSessions,
}
impl User {
pub fn has_permission(&self, permission: Permission) -> Result<bool, rusqlite::Error> {
pub fn has_permission(&self, permission: Permission) -> Result<bool, DatabaseError> {
if self.is_infradmin() || self.is_systemuser() {
return Ok(true);
}