changes to organization model
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user