summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/delete.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/guilds/#guild_id/delete.ts')
-rw-r--r--src/api/routes/guilds/#guild_id/delete.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/routes/guilds/#guild_id/delete.ts b/src/api/routes/guilds/#guild_id/delete.ts
index dee52c81..364faa4f 100644
--- a/src/api/routes/guilds/#guild_id/delete.ts
+++ b/src/api/routes/guilds/#guild_id/delete.ts
@@ -17,7 +17,7 @@
 */
 
 import { route } from "@spacebar/api";
-import { Guild, GuildDeleteEvent, emitEvent } from "@spacebar/util";
+import { Guild, GuildDeleteEvent, emitEvent, getRights } from "@spacebar/util";
 import { Request, Response, Router } from "express";
 import { HTTPError } from "lambert-server";
 
@@ -40,12 +40,13 @@ router.post(
 	}),
 	async (req: Request, res: Response) => {
 		const { guild_id } = req.params;
+		const rights = await getRights(req.user_id);
 
 		const guild = await Guild.findOneOrFail({
 			where: { id: guild_id },
 			select: ["owner_id"],
 		});
-		if (guild.owner_id !== req.user_id)
+		if (!rights.has("OPERATOR") || guild.owner_id !== req.user_id)
 			throw new HTTPError("You are not the owner of this guild", 401);
 
 		await Promise.all([