]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/admin.js
Format video blacklist
[github/Chocobozzz/PeerTube.git] / server / middlewares / admin.js
index e6d9dc8878a7a4a3725e9f575121c4bef6a44b7a..3288f4c6b9351ee89a8470bb13c4155e8a2dc65b 100644 (file)
@@ -1,6 +1,5 @@
 'use strict'
 
-const constants = require('../initializers/constants')
 const logger = require('../helpers/logger')
 
 const adminMiddleware = {
@@ -9,7 +8,7 @@ const adminMiddleware = {
 
 function ensureIsAdmin (req, res, next) {
   const user = res.locals.oauth.token.user
-  if (user.role !== constants.USER_ROLES.ADMIN) {
+  if (user.isAdmin() === false) {
     logger.info('A non admin user is trying to access to an admin content.')
     return res.sendStatus(403)
   }