summary refs log tree commit diff
path: root/api/src/util/route.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-25 04:20:35 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-25 04:20:35 +0200
commite2a22da5c4881d2bdf992b3950f48fa62a4b391e (patch)
treed033c9f16c743d34670590688160980d0497a43c /api/src/util/route.ts
parent:bug: fix guild template create (diff)
downloadserver-e2a22da5c4881d2bdf992b3950f48fa62a4b391e.tar.xz
:bug: fix #392
Diffstat (limited to '')
-rw-r--r--api/src/util/route.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/util/route.ts b/api/src/util/route.ts
index e7c7ed1c..45882d8a 100644
--- a/api/src/util/route.ts
+++ b/api/src/util/route.ts
@@ -81,10 +81,10 @@ export function route(opts: RouteOptions) {
 	return async (req: Request, res: Response, next: NextFunction) => {
 		if (opts.permission) {
 			const required = new Permissions(opts.permission);
-			const permission = await getPermission(req.user_id, req.params.guild_id, req.params.channel_id);
+			req.permission = await getPermission(req.user_id, req.params.guild_id, req.params.channel_id);
 
 			// bitfield comparison: check if user lacks certain permission
-			if (!permission.has(required)) {
+			if (!req.permission.has(required)) {
 				throw DiscordApiErrors.MISSING_PERMISSIONS.withParams(opts.permission as string);
 			}
 		}