From 8f39a1403d3c94f3d51693e41843750352408cba Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 29 Mar 2018 08:32:54 +0100 Subject: Address numerous errors in test suites Many errors still remian. --- src/app.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index ad00105..c627027 100644 --- a/src/app.ts +++ b/src/app.ts @@ -12,6 +12,7 @@ import FileRouter from './FileRouter'; import { default as File } from './db/model/File'; import { default as Project } from './db/model/Project'; import { default as User } from './db/model/User'; +import { default as UserGroup } from './db/model/UserGroup'; /** * Configuration of the Express server app, including installation of @@ -67,6 +68,21 @@ class App { ] }) ); this.express.use(passport.initialize()); + this.express.use(async( + req: ex.Request, res: ex.Response, next: ex.NextFunction + ): Promise => { + if (req.user != null) { + req.user = await User.findOne({ + where: { + username: req.user.object.username + }, + include: [ + UserGroup + ] + }); + } + next(); + }); if (this.logEnabled) { this.express.use(logger('combined')); } -- cgit v1.2.1