2022-03-12 17:31:53 +01:00
|
|
|
use std::sync::Arc;
|
|
|
|
use crate::authorization::permissions::Permission;
|
|
|
|
use crate::authorization::roles::Role;
|
|
|
|
use crate::users::User;
|
2022-03-10 20:52:34 +01:00
|
|
|
|
|
|
|
pub mod permissions;
|
2022-03-12 17:31:53 +01:00
|
|
|
pub mod roles;
|
|
|
|
|
|
|
|
struct Inner {
|
|
|
|
|
|
|
|
}
|
|
|
|
impl Inner {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct AuthorizationHandle {
|
|
|
|
inner: Arc<Inner>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AuthorizationHandle {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {
|
|
|
|
inner: Arc::new(Inner::new())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-13 22:50:37 +01:00
|
|
|
pub fn get_user_roles(&self, uid: impl AsRef<str>) -> Option<impl IntoIterator<Item=Role>> {
|
|
|
|
unimplemented!();
|
|
|
|
Some([])
|
2022-03-12 17:31:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_permitted<'a>(&self, roles: impl IntoIterator<Item=&'a Role>, perm: impl AsRef<Permission>) -> bool {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|