1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 12:42:44 +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 835a5ab3a3
commit 95e7238e8f
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) {