feat: restrict permissions for users in timeout

This commit is contained in:
Paul Makles
2022-07-15 13:55:55 +01:00
parent 741b8ee8fd
commit 4f73e43a03
4 changed files with 40 additions and 3 deletions

View File

@@ -45,8 +45,23 @@ impl Override {
impl PermissionValue {
/// Apply a given override to this value
pub fn apply(&mut self, v: Override) {
self.0 |= v.allow;
self.0 &= !v.deny;
self.allow(v.allow);
self.revoke(v.deny);
}
/// Allow given permissions
pub fn allow(&mut self, v: u64) {
self.0 |= v;
}
/// Revoke given permissions
pub fn revoke(&mut self, v: u64) {
self.0 &= !v;
}
/// Restrict to given permissions
pub fn restrict(&mut self, v: u64) {
self.0 &= v;
}
}