function loggedIn(req, res, next) {
  if (req.user && req.user.id && req.user.tenant === db.getTenantSchema()) {
    next();
  } else {
    req.flash("danger", req.__("Must be logged in first"));
    res.redirect("/auth/login");
  }
}
Checks that user logged or not.
If not shows than shows flash and redirects to login
@param {object} req
@param {object} res
@param {function} next
@returns {void}