fix: revoke all channel permissions if can't view

This commit is contained in:
Paul Makles
2023-08-14 10:22:16 +01:00
parent 3d0914ce52
commit 004e84ece9
2 changed files with 9 additions and 0 deletions

View File

@@ -118,6 +118,10 @@ pub async fn calculate_channel_permissions<P: PermissionQuery>(query: &mut P) ->
permissions.restrict(*ALLOW_IN_TIMEOUT);
}
if !permissions.has_channel_permission(ChannelPermission::ViewChannel) {
permissions.revoke_all();
}
permissions
} else {
0_u64.into()

View File

@@ -28,6 +28,11 @@ impl PermissionValue {
self.0 &= !v;
}
/// Revoke all permissions
pub fn revoke_all(&mut self) {
self.0 = 0;
}
/// Restrict to given permissions
pub fn restrict(&mut self, v: u64) {
self.0 &= v;