aboutsummaryrefslogtreecommitdiff
path: root/logic/src/permission.rs
blob: c23ad41e6c8addafd5425223ef3fc72375af16e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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."))
        }
    }
}