diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-04 12:48:16 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-04 12:48:16 +0200 |
commit | 4095a8804c17c3ec12706f00d3694f564afc0b95 (patch) | |
tree | f690a5a1c1d3f1025b71bb35f8f76d3a9a63cd59 /base/src/permission.rs | |
parent | 55494f0d1f6d3106ba61a966423af9e80e034749 (diff) | |
download | jellything-4095a8804c17c3ec12706f00d3694f564afc0b95.tar jellything-4095a8804c17c3ec12706f00d3694f564afc0b95.tar.bz2 jellything-4095a8804c17c3ec12706f00d3694f564afc0b95.tar.zst |
basic management of user permissions
Diffstat (limited to 'base/src/permission.rs')
-rw-r--r-- | base/src/permission.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/src/permission.rs b/base/src/permission.rs index 8993154..382a16e 100644 --- a/base/src/permission.rs +++ b/base/src/permission.rs @@ -3,19 +3,19 @@ use anyhow::anyhow; use jellycommon::user::{PermissionSet, UserPermission}; pub trait PermissionSetExt { - fn check(&self, perm: UserPermission) -> bool; - fn assert(&self, perm: UserPermission) -> Result<(), anyhow::Error>; + fn check(&self, perm: &UserPermission) -> bool; + fn assert(&self, perm: &UserPermission) -> Result<(), anyhow::Error>; } impl PermissionSetExt for PermissionSet { - fn check(&self, perm: UserPermission) -> bool { + fn check(&self, perm: &UserPermission) -> bool { *self .0 .get(&perm) .or(CONF.default_permission_set.0.get(&perm)) .unwrap_or(&perm.default_value()) } - fn assert(&self, perm: UserPermission) -> Result<(), anyhow::Error> { + fn assert(&self, perm: &UserPermission) -> Result<(), anyhow::Error> { if self.check(perm) { Ok(()) } else { |