changes to organization model

This commit is contained in:
Arjun Patel
2019-03-01 23:38:22 -08:00
parent d14e111f53
commit 571c3931c2
4 changed files with 70 additions and 7 deletions
+4 -1
View File
@@ -5,8 +5,11 @@ module.exports = role => (req, res, next) => {
try {
const token = req.headers.authorization.split(' ')[1];
const decoded = jwt.verify(token, process.env.JWT_KEY);
req.user = decoded; //for use till end of request
// user info till end of request
req.user = decoded;
// verify role of the call
if (role != req.user.role) {
throw new Error();
}