summary refs log tree commit diff
path: root/api/src/middlewares/Authentication.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-04 10:47:04 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-04 10:47:04 +0200
commitb69f5baeb997cecd12a0e42b94fe0616058866a2 (patch)
treea63c89ba5bb52249f2ab858c703bab0dc82b5e84 /api/src/middlewares/Authentication.ts
parent:sparkles: custom user flags offset (diff)
parentMerge pull request #412 from TheArcaneBrony/master (diff)
downloadserver-b69f5baeb997cecd12a0e42b94fe0616058866a2.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to 'api/src/middlewares/Authentication.ts')
-rw-r--r--api/src/middlewares/Authentication.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts

index a300c786..5a082751 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts
@@ -1,6 +1,6 @@ import { NextFunction, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { checkToken, Config } from "@fosscord/util"; +import { checkToken, Config, Rights } from "@fosscord/util"; export const NO_AUTHORIZATION_ROUTES = [ "/auth/login", @@ -21,6 +21,7 @@ declare global { user_id: string; user_bot: boolean; token: string; + rights: Rights; } } } @@ -46,6 +47,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc req.token = decoded; req.user_id = decoded.id; req.user_bot = user.bot; + req.rights = new Rights(Number(user.rights)); return next(); } catch (error: any) { return next(new HTTPError(error?.toString(), 400));