From 13eb58ec060d3025715da779b2582b6a8789d55a Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 21 Nov 2020 19:18:40 -0800 Subject: [PATCH] * Owner perms were not being calculated correctly, this is now fixed --- server-api/client-tests/client.py | 1 - server-api/src/auth.rs | 4 +++- server-api/src/perms.rs | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server-api/client-tests/client.py b/server-api/client-tests/client.py index f47274a..38be743 100644 --- a/server-api/client-tests/client.py +++ b/server-api/client-tests/client.py @@ -121,7 +121,6 @@ if __name__ == '__main__': msg_chan_id = time.time() msg_chan_raw = worker.post('/channels/create', name=f'{msg_chan_id}', kind=TEXT_CHANNEL) msg_chan = json.loads(msg_chan_raw) - print(f'Channel id to be used: {msg_chan["id"]}') worker.post('/message/send', channel=msg_chan['id'], content="some random content") worker.delete('/channels/delete', channel_id=msg_chan['id']) # finally clean up the channel we created diff --git a/server-api/src/auth.rs b/server-api/src/auth.rs index a82b3c9..62ae751 100644 --- a/server-api/src/auth.rs +++ b/server-api/src/auth.rs @@ -36,7 +36,9 @@ fn valid_perms(member: Member, path: &str) -> bool { return (p & member.permissions) == p; } // if no perms then we don't care - return true; + else { + return true; + } } pub fn generate_secret() -> String { diff --git a/server-api/src/perms.rs b/server-api/src/perms.rs index 266be43..ddf48be 100644 --- a/server-api/src/perms.rs +++ b/server-api/src/perms.rs @@ -8,8 +8,6 @@ pub const CREATE_TMP_INVITES:u64 = 4; pub const CREATE_PERM_INVITES:u64 = 8; // to make perma invites you need both flags - -pub const OWNER: u64 = 1 << 63; pub const _ADMIN: u64 = 1 << 62; // can make other admins but can't really touch the owner // ADMIN PERMS @@ -17,7 +15,7 @@ pub const CREATE_CHANNEL:u64 = 64; pub const DELETE_CHANNEL:u64 = 128; // BELOW ARE COLLECTIVE PERMISSION SETS -pub const _OWNER_PERMS: u64 = std::u64::MAX; +pub const OWNER: u64 = std::u64::MAX; pub const GENERAL_NEW: u64 = JOIN_VOICE | SEND_MESSAGES | ALLOW_PFP | CHANGE_NICK; pub const ADMIN_PERMS: u64 = !(std::u64::MAX & OWNER); // filter the only perm admins don't get