aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/admin.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/admin.js')
-rw-r--r--server/middlewares/admin.js3
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
3const constants = require('../initializers/constants')
4const logger = require('../helpers/logger') 3const logger = require('../helpers/logger')
5 4
6const adminMiddleware = { 5const adminMiddleware = {
@@ -9,7 +8,7 @@ const adminMiddleware = {
9 8
10function ensureIsAdmin (req, res, next) { 9function 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 }