app.js
/**
 * Performs authorization.
 *
 * Access is automatically granted to admin users, otherwise provided
 * function is called to perform authorization. If no function
 * is provided request will be ended with 404 status.
 *
 * @param {Function} function to perform authorization
 */
Performs authorization.
Access is automatically granted to admin users, otherwise provided
function is called to perform authorization. If no function
is provided request will be ended with 404 status.

@param {Function} function to perform authorization
Performs authorization . Access is automatically granted to admin users otherwise provided function is called to perform authorization . If no function is provided request will be ended with 404 status . @param { Function } function to perform authorization
function grantAccess(fn) {
  return function (req, res, next) {
    for (var i = 0; i < credentials.admins.length; i++) {
      if (credentials.admins[i].email === req.session.user.email) {
        return next(); 
      }
    }
    if (fn) 
      fn(req, res, next);
    else
      return next(new HttpError(404));
  };
}
function grantAccess ( fn ) { return function ( req , res , next ) { for ( var i = 0 ; i < credentials . admins . length ; i ++ ) { if ( credentials . admins [ i ] . email === req . session . user . email ) { return next ( ) ; } } if ( fn ) fn ( req , res , next ) ; else return next ( new HttpError ( 404 ) ) ; } ; }
Performs authorization.
Performs authorization .
// forward admin users // forward to auth fn