function verifyUser(req, res, next) {
        
        let verifiedJwt;
        verifiedJwt = verifyJwt(req, next);
        if(req.params && req.params.userId) {
            if(req.params.userId != verifiedJwt.id) {
                return next(helpers.basicError("User not authorized to update resource", 403));
            }
            return next();
        }
        return next();
        
    }
// Middleware for verifying that a user has permission to peform CRUD operations.
Middleware for verifying that a user has permission to peform CRUD operations.
Middleware for verifying that a user has permission to peform CRUD operations .
function verifyUser(req, res, next) {
        let verifiedJwt;
        verifiedJwt = verifyJwt(req, next);
        if(req.params && req.params.userId) {
            if(req.params.userId != verifiedJwt.id) {
                return next(helpers.basicError("User not authorized to update resource", 403));
            }
            return next();
        }
        return next();
    }
function verifyUser ( req , res , next ) { let verifiedJwt ; verifiedJwt = verifyJwt ( req , next ) ; if ( req . params && req . params . userId ) { if ( req . params . userId != verifiedJwt . id ) { return next ( helpers . basicError ( "User not authorized to update resource" , 403 ) ) ; } return next ( ) ; } return next ( ) ; }
Middleware for verifying that a user has permission to peform CRUD operations.
Middleware for verifying that a user has permission to peform CRUD operations .