mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-29 19:18:17 +00:00
impl <T: UserInformation> UserInformation for std::sync::Arc<T>
This commit is contained in:
parent
254ef7ff82
commit
fb2b7a4e93
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
/// Access permission
|
/// Access permission
|
||||||
#[cfg_attr(feature = "test-harness", derive(Eq, PartialEq))]
|
#[cfg_attr(feature = "test-harness", derive(Eq, PartialEq))]
|
||||||
@ -72,6 +73,18 @@ pub trait UserInformation {
|
|||||||
fn lookup_privs(&self, userid: &str, path: &[&str]) -> u64;
|
fn lookup_privs(&self, userid: &str, path: &[&str]) -> u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl <T: UserInformation> UserInformation for std::sync::Arc<T> {
|
||||||
|
fn is_superuser(&self, userid: &str) -> bool {
|
||||||
|
self.deref().is_superuser(userid)
|
||||||
|
}
|
||||||
|
fn is_group_member(&self, userid: &str, group: &str) -> bool {
|
||||||
|
self.deref().is_group_member(userid, group)
|
||||||
|
}
|
||||||
|
fn lookup_privs(&self, userid: &str, path: &[&str]) -> u64 {
|
||||||
|
self.deref().lookup_privs(userid, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Example implementation to check access permissions
|
/// Example implementation to check access permissions
|
||||||
///
|
///
|
||||||
/// This implementation supports URI variables in Privilege path
|
/// This implementation supports URI variables in Privilege path
|
||||||
|
Loading…
Reference in New Issue
Block a user