2022-06-20 15:19:25 +02:00
|
|
|
use crate::authorization::roles::Role;
|
|
|
|
use crate::Roles;
|
2022-11-04 17:25:17 +01:00
|
|
|
use api::permissions_capnp::permissions::{
|
|
|
|
self, ListRolesParams, ListRolesResults,
|
2022-06-20 15:19:25 +02:00
|
|
|
};
|
|
|
|
use capnp::capability::Promise;
|
|
|
|
use capnp::Error;
|
2022-06-24 13:57:47 +02:00
|
|
|
use tracing::Span;
|
2022-03-15 20:00:43 +01:00
|
|
|
|
2022-03-12 17:31:53 +01:00
|
|
|
use crate::session::SessionHandle;
|
2022-03-11 22:13:54 +01:00
|
|
|
|
2022-06-24 13:57:47 +02:00
|
|
|
const TARGET: &str = "bffh::api::permissionsystem";
|
|
|
|
|
2022-06-20 15:19:25 +02:00
|
|
|
pub struct Permissions {
|
2022-06-24 13:57:47 +02:00
|
|
|
span: Span,
|
2022-06-20 15:19:25 +02:00
|
|
|
roles: Roles,
|
|
|
|
}
|
2022-03-11 22:13:54 +01:00
|
|
|
|
2022-03-12 17:31:53 +01:00
|
|
|
impl Permissions {
|
2022-06-20 15:19:25 +02:00
|
|
|
pub fn new(session: SessionHandle) -> Self {
|
2022-06-24 13:57:47 +02:00
|
|
|
let span = tracing::info_span!(target: TARGET, "PermissionSystem",);
|
2022-06-20 15:19:25 +02:00
|
|
|
Self {
|
2022-06-24 13:57:47 +02:00
|
|
|
span,
|
2022-06-20 15:19:25 +02:00
|
|
|
roles: session.roles,
|
|
|
|
}
|
2022-03-12 17:31:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-04 17:25:17 +01:00
|
|
|
impl permissions::Server for Permissions {
|
2022-06-24 13:57:47 +02:00
|
|
|
|
2022-06-20 15:19:25 +02:00
|
|
|
}
|