diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-30 13:32:48 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-30 13:32:48 +1000 |
commit | 9886f19d79861e326ba242dee481ed9b91da6994 (patch) | |
tree | 2c746d9662fe6601ef426e818effb7ca88f41884 | |
parent | Fix fetching members for roles in POST message (diff) | |
download | server-9886f19d79861e326ba242dee481ed9b91da6994.tar.xz |
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
-rw-r--r-- | src/api/routes/guilds/#guild_id/index.ts | 2 | ||||
-rw-r--r-- | src/util/util/Rights.ts | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts index d1d67193..c8ee6551 100644 --- a/src/api/routes/guilds/#guild_id/index.ts +++ b/src/api/routes/guilds/#guild_id/index.ts @@ -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", ); diff --git a/src/util/util/Rights.ts b/src/util/util/Rights.ts index 659353a6..d6e539c0 100644 --- a/src/util/util/Rights.ts +++ b/src/util/util/Rights.ts @@ -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) { |