X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fuser-right.ts;h=4da7b9802516d02c0ac028557e15878dc119bb8a;hb=b6e0e6a31bdef7c0faebca96864eb334dd9e7ad7;hp=7cea7aa1e6c0e34eb2e812df4024956da44d7cc8;hpb=eec63bbc0f4fdb39e56f37127b35c449f90a135f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index 7cea7aa1e..4da7b9802 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts @@ -1,12 +1,10 @@ import * as express from 'express' -import 'express-validator' import { UserRight } from '../../shared' import { logger } from '../helpers/logger' -import { UserModel } from '../models/account/user' function ensureUserHasRight (userRight: UserRight) { return function (req: express.Request, res: express.Response, next: express.NextFunction) { - const user = res.locals.oauth.token.user as UserModel + const user = res.locals.oauth.token.user if (user.hasRight(userRight) === false) { const message = `User ${user.username} does not have right ${UserRight[userRight]} to access to ${req.path}.` logger.info(message)