diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-31 03:26:45 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-31 03:26:45 +0200 |
commit | 3e834092ba230ee081065a3b80ad227d585b5a13 (patch) | |
tree | b168d1524045716e6922c137f1ad92bdf3f47994 /logic/src/permission.rs | |
parent | 3b15caade07e8fbe351fed9aceb3f435bf58368e (diff) | |
download | jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar.bz2 jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar.zst |
get rid of admin session; checking manually instead
Diffstat (limited to 'logic/src/permission.rs')
-rw-r--r-- | logic/src/permission.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/logic/src/permission.rs b/logic/src/permission.rs new file mode 100644 index 0000000..c23ad41 --- /dev/null +++ b/logic/src/permission.rs @@ -0,0 +1,18 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2025 metamuffin <metamuffin.org> +*/ + +use crate::session::Session; +use anyhow::{Result, anyhow}; + +impl Session { + pub fn assert_admin(&self) -> Result<()> { + if self.user.admin { + Ok(()) + } else { + Err(anyhow!("Permission denied.")) + } + } +} |