diff options
| author | Tom Harley | 2018-03-29 08:32:54 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-03-29 08:32:54 +0100 |
| commit | 8f39a1403d3c94f3d51693e41843750352408cba (patch) | |
| tree | 4833fd458e1d8590d798b8d1ede14bfb487aadea /src/app.ts | |
| parent | Merge branch 'testing-middleware' into development (diff) | |
| download | medicine-8f39a1403d3c94f3d51693e41843750352408cba.tar.gz medicine-8f39a1403d3c94f3d51693e41843750352408cba.zip | |
Address numerous errors in test suites
Many errors still remian.
Diffstat (limited to 'src/app.ts')
| -rw-r--r-- | src/app.ts | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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<void> => { + 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')); } |
