From 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Dec 2017 17:53:50 +0100 Subject: Move models to typescript-sequelize --- server/middlewares/user-right.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server/middlewares/user-right.ts') diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index bcebe9d7f..5d63ebaf4 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts @@ -1,13 +1,12 @@ -import 'express-validator' import * as express from 'express' - -import { UserInstance } from '../models' +import 'express-validator' import { UserRight } from '../../shared' import { logger } from '../helpers' +import { UserModel } from '../models/account/user' function ensureUserHasRight (userRight: UserRight) { return function (req: express.Request, res: express.Response, next: express.NextFunction) { - const user: UserInstance = res.locals.oauth.token.user + const user = res.locals.oauth.token.user as UserModel if (user.hasRight(userRight) === false) { logger.info('User %s does not have right %s to access to %s.', user.username, UserRight[userRight], req.path) return res.sendStatus(403) -- cgit v1.2.3