function isAdmin(req, res, next) {
  const cur_tenant = db.getTenantSchema();
  //console.log({ cur_tenant, user: req.user });
  if (req.user && req.user.role_id === 1 && req.user.tenant === cur_tenant) {
    next();
  } else {
    req.flash("danger", req.__("Must be admin"));
    res.redirect(
      req.user && req.user.pending_user
        ? "/auth/twofa/login/totp"
        : req.user
          ? "/"
          : `/auth/login?dest=${encodeURIComponent(req.originalUrl)}`
    );
  }
}
Checks that user has admin role or not.
If user hasn't admin role shows flash and redirects user to login or totp
@param {object} req
@param {object} res
@param {function} next
@returns {void}