Created
January 6, 2017 16:34
-
-
Save anymaniax/3ba3b1b188e079c6976b23413a6bd058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.requireId = (req, res, next) => { | |
if(!req.decode || req.decode._id !== req.params.id || req.decode.role !== 'admin'){ | |
return res.json({ | |
success: false, | |
message: 'Failed to Authentication' | |
}); | |
} | |
next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment