From e34887261f8d86aa4e98f4b8ccd6e57ce72c6620 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Wed, 20 Dec 2023 03:33:28 -0500 Subject: initial progress for admin api --- src/api/util/handlers/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/api/util') diff --git a/src/api/util/handlers/route.ts b/src/api/util/handlers/route.ts index 5a0b48e6..eef6c526 100644 --- a/src/api/util/handlers/route.ts +++ b/src/api/util/handlers/route.ts @@ -89,7 +89,7 @@ export function route(opts: RouteOptions) { } return async (req: Request, res: Response, next: NextFunction) => { - if (opts.permission) { + if (opts.permission && !opts.right) { const required = new Permissions(opts.permission); req.permission = await getPermission( req.user_id, @@ -103,6 +103,8 @@ export function route(opts: RouteOptions) { opts.permission as string, ); } + + req.has_permission = true; } if (opts.right) { @@ -114,6 +116,7 @@ export function route(opts: RouteOptions) { opts.right as string, ); } + req.has_right = true; } if (validate) { -- cgit 1.5.1