summary refs log tree commit diff
path: root/api/src/util/handlers/route.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:34:43 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:34:43 +1000
commit74857223acc0b9ef67c6a5ca437637591a828619 (patch)
tree919124034d3aac958878cfe8101676de9f09064c /api/src/util/handlers/route.ts
parentEnsure password was given if email is given in PATCH @me (diff)
parentFormat changed files (diff)
downloadserver-74857223acc0b9ef67c6a5ca437637591a828619.tar.xz
Merge branch 'master' into fix/claim_accounts
Diffstat (limited to '')
-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); }