diff --git a/app/routes/articles.js b/app/routes/articles.js index 4c68a4a959..5d58d2a9ca 100644 --- a/app/routes/articles.js +++ b/app/routes/articles.js @@ -6,13 +6,13 @@ var authorization = require('./middlewares/authorization'); // Article authorization helpers var hasAuthorization = function(req, res, next) { - if (req.article.user.id != req.user.id) { + if (req.article.user.id !== req.user.id) { return res.send(401, 'User is not authorized'); } next(); -} +}; -module.exports = function(app, passport) { +module.exports = function(app) { app.get('/articles', articles.all); app.post('/articles', authorization.requiresLogin, articles.create); @@ -23,4 +23,4 @@ module.exports = function(app, passport) { // Finish with setting up the articleId param app.param('articleId', articles.article); -}; +}; \ No newline at end of file diff --git a/app/routes/index.js b/app/routes/index.js index 688ea14996..f6b0b3ef57 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(app, passport) { +module.exports = function(app) { // Home route var index = require('../controllers/index'); diff --git a/app/routes/users.js b/app/routes/users.js index 0cc59b42fb..02793d5b4d 100644 --- a/app/routes/users.js +++ b/app/routes/users.js @@ -3,14 +3,6 @@ // User routes use users controller var users = require('../controllers/users'); -// User authorization helpers -var hasAuthorization = function(req, res, next) { - if (req.profile.id != req.user.id) { - return res.send(401, 'User is not authorized'); - } - next(); -} - module.exports = function(app, passport) { app.get('/signin', users.signin);