feat(core): provide user profile where appropriate

This commit is contained in:
Paul Makles
2023-10-16 09:33:36 +01:00
parent 0b6e5dd9db
commit cb97004d3f
9 changed files with 96 additions and 54 deletions

View File

@@ -8,7 +8,7 @@ pub use server::*;
pub use user::*;
/// Holds a permission value to manipulate.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct PermissionValue(u64);
impl PermissionValue {
@@ -43,6 +43,11 @@ impl PermissionValue {
(self.0 & v) == v
}
/// Check whether certain a user permission has been granted
pub fn has_user_permission(&self, permission: UserPermission) -> bool {
self.has(permission as u64)
}
/// Check whether certain a channel permission has been granted
pub fn has_channel_permission(&self, permission: ChannelPermission) -> bool {
self.has(permission as u64)