mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-11 01:53:23 +01:00
25 lines
491 B
Rust
25 lines
491 B
Rust
|
|
|
|
use crate::authorization::roles::{Roles};
|
|
use crate::Users;
|
|
|
|
|
|
pub mod permissions;
|
|
pub mod roles;
|
|
|
|
#[derive(Clone)]
|
|
pub struct AuthorizationHandle {
|
|
users: Users,
|
|
roles: Roles,
|
|
}
|
|
|
|
impl AuthorizationHandle {
|
|
pub fn new(users: Users, roles: Roles) -> Self {
|
|
Self { users, roles }
|
|
}
|
|
|
|
pub fn get_user_roles(&self, uid: impl AsRef<str>) -> Option<Vec<String>> {
|
|
let user = self.users.get_user(uid.as_ref())?;
|
|
Some(user.userdata.roles.clone())
|
|
}
|
|
} |