function hasRole(roleRequired) {
    if (!roleRequired) throw new Error('Required role needs to be set');
  
    return compose().use(isAuthenticated()).use(function meetsRequirements(req, res, next) {
      if (roles.indexOf(req.user.role) >= roles.indexOf(roleRequired)) {
        next();
      } else {
        res.sendStatus(403);
      }
    });
  }
/**
   * Checks if the user role meets the minimum requirements of the route
   */
Checks if the user role meets the minimum requirements of the route
Checks if the user role meets the minimum requirements of the route
function hasRole(roleRequired) {
    if (!roleRequired) throw new Error('Required role needs to be set');
    return compose().use(isAuthenticated()).use(function meetsRequirements(req, res, next) {
      if (roles.indexOf(req.user.role) >= roles.indexOf(roleRequired)) {
        next();
      } else {
        res.sendStatus(403);
      }
    });
  }
function hasRole ( roleRequired ) { if ( ! roleRequired ) throw new Error ( 'Required role needs to be set' ) ; return compose ( ) . use ( isAuthenticated ( ) ) . use ( function meetsRequirements ( req , res , next ) { if ( roles . indexOf ( req . user . role ) >= roles . indexOf ( roleRequired ) ) { next ( ) ; } else { res . sendStatus ( 403 ) ; } } ) ; }
Checks if the user role meets the minimum requirements of the route
Checks if the user role meets the minimum requirements of the route