aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/admin.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-27 16:55:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-27 16:55:03 +0200
commit954605a804da399317ca62afa2fb9244afa11ebf (patch)
treede6ee69280bfb928bc01c29430e13d5b820e921a /server/middlewares/admin.ts
parente02573ad67626210ed279bad321ee139094921a1 (diff)
downloadPeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.gz
PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.zst
PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.zip
Support roles with rights and add moderator role
Diffstat (limited to 'server/middlewares/admin.ts')
-rw-r--r--server/middlewares/admin.ts20
1 files changed, 0 insertions, 20 deletions
diff --git a/server/middlewares/admin.ts b/server/middlewares/admin.ts
deleted file mode 100644
index 812397352..000000000
--- a/server/middlewares/admin.ts
+++ /dev/null
@@ -1,20 +0,0 @@
1import 'express-validator'
2import * as express from 'express'
3
4import { logger } from '../helpers'
5
6function ensureIsAdmin (req: express.Request, res: express.Response, next: express.NextFunction) {
7 const user = res.locals.oauth.token.user
8 if (user.isAdmin() === false) {
9 logger.info('A non admin user is trying to access to an admin content.')
10 return res.sendStatus(403)
11 }
12
13 return next()
14}
15
16// ---------------------------------------------------------------------------
17
18export {
19 ensureIsAdmin
20}