1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 19:52:36 +01:00

Split MANAGE_GUILDS right into MANAGE_GUILDS for instance-wide control and SELF_EDIT_GUILDS for control over guilds you own or have perms to edit

This commit is contained in:
Madeline 2022-09-30 13:32:48 +10:00
parent e7b7029244
commit 9886f19d79
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
2 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,7 @@ router.patch(
const rights = await getRights(req.user_id);
const permission = await getPermission(req.user_id, guild_id);
if (!rights.has("MANAGE_GUILDS") || !permission.has("MANAGE_GUILD"))
if (!rights.has("SELF_EDIT_GUILDS") || !permission.has("MANAGE_GUILD"))
throw DiscordApiErrors.MISSING_PERMISSIONS.withParams(
"MANAGE_GUILD",
);

View File

@ -32,7 +32,7 @@ export class Rights extends BitField {
static FLAGS = {
OPERATOR: BitFlag(0), // has all rights
MANAGE_APPLICATIONS: BitFlag(1),
MANAGE_GUILDS: BitFlag(2),
MANAGE_GUILDS: BitFlag(2), // Manage all guilds instance-wide
MANAGE_MESSAGES: BitFlag(3), // Can't see other messages but delete/edit them in channels that they can see
MANAGE_RATE_LIMITS: BitFlag(4),
MANAGE_ROUTING: BitFlag(5), // can create custom message routes to any channel/guild
@ -78,6 +78,7 @@ export class Rights extends BitField {
SEND_BACKDATED_EVENTS: BitFlag(42), // can send backdated events
USE_MASS_INVITES: BitFlag(43), // added per @xnacly's request — can accept mass invites
ACCEPT_INVITES: BitFlag(44), // added per @xnacly's request — can accept user-specific invites and DM requests
SELF_EDIT_GUILDS: BitFlag(45), // Edit guilds you own or have permission to edit
};
any(permission: RightResolvable, checkOperator = true) {