summary refs log tree commit diff
path: root/api/src/util
diff options
context:
space:
mode:
authorErkin Alp Güney <erkinalp9035@gmail.com>2022-04-18 22:02:32 +0300
committerErkin Alp Güney <erkinalp9035@gmail.com>2022-04-18 22:02:32 +0300
commit3061c24780a2dcf46dc4960d50c3636cab6b918f (patch)
tree2a48ace270e84b3c639b9ae1966c4a2d42d5eaa2 /api/src/util
parentMerge branch 'master' of https://github.com/fosscord/fosscord-server (diff)
downloadserver-3061c24780a2dcf46dc4960d50c3636cab6b918f.tar.xz
general rights enforcement stuff
Diffstat (limited to 'api/src/util')
-rw-r--r--api/src/util/handlers/route.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/api/src/util/handlers/route.ts b/api/src/util/handlers/route.ts
index 0048c4dd..3d3bbc37 100644
--- a/api/src/util/handlers/route.ts
+++ b/api/src/util/handlers/route.ts
@@ -6,6 +6,7 @@ import {
 	FieldErrors,
 	FosscordApiErrors,
 	getPermission,
+	getRights,
 	PermissionResolvable,
 	Permissions,
 	RightResolvable,
@@ -105,6 +106,8 @@ export function route(opts: RouteOptions) {
 
 		if (opts.right) {
 			const required = new Rights(opts.right);
+			req.rights = await getRights(req.user_id);
+
 			if (!req.rights || !req.rights.has(required)) {
 				throw FosscordApiErrors.MISSING_RIGHTS.withParams(opts.right as string);
 			}