diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-04-26 21:42:36 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-04-26 21:42:36 +0200 |
commit | ab683a8e0d998cfd9dfb9562d3c616f3e6e1dbfd (patch) | |
tree | 8f6d77c733b56a3778156eb717b188a1addc7676 /server/middlewares/admin.js | |
parent | 32502eda29f67ef111391d751f61132f8103fda8 (diff) | |
download | PeerTube-ab683a8e0d998cfd9dfb9562d3c616f3e6e1dbfd.tar.gz PeerTube-ab683a8e0d998cfd9dfb9562d3c616f3e6e1dbfd.tar.zst PeerTube-ab683a8e0d998cfd9dfb9562d3c616f3e6e1dbfd.zip |
Format video blacklist
Diffstat (limited to 'server/middlewares/admin.js')
-rw-r--r-- | server/middlewares/admin.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/server/middlewares/admin.js b/server/middlewares/admin.js index e6d9dc887..3288f4c6b 100644 --- a/server/middlewares/admin.js +++ b/server/middlewares/admin.js | |||
@@ -1,6 +1,5 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const constants = require('../initializers/constants') | ||
4 | const logger = require('../helpers/logger') | 3 | const logger = require('../helpers/logger') |
5 | 4 | ||
6 | const adminMiddleware = { | 5 | const adminMiddleware = { |
@@ -9,7 +8,7 @@ const adminMiddleware = { | |||
9 | 8 | ||
10 | function ensureIsAdmin (req, res, next) { | 9 | function ensureIsAdmin (req, res, next) { |
11 | const user = res.locals.oauth.token.user | 10 | const user = res.locals.oauth.token.user |
12 | if (user.role !== constants.USER_ROLES.ADMIN) { | 11 | if (user.isAdmin() === false) { |
13 | logger.info('A non admin user is trying to access to an admin content.') | 12 | logger.info('A non admin user is trying to access to an admin content.') |
14 | return res.sendStatus(403) | 13 | return res.sendStatus(403) |
15 | } | 14 | } |