INNER CODE UNIT · TypeScript

getMaximumRole

cisagov/crossfeed · backend/src/api/app.ts:146

const getMaximumRole = (user) => {
  if (user?.userType === UserType.GLOBAL_VIEW) return 'user';
  return user && user.roles && user.roles.find((role) => role.role === 'admin')
    ? 'admin'
    : 'user';
};

const getToUVersion = (user) => {
  return `v${process.env.REACT_APP_TERMS_VERSION}-${getMaximumRole(user)}`;
};

// Rewrite the URL for some Matomo admin dashboard URLs, due to a bug in
// how Matomo handles relative URLs when hosted on a subpath.
app.get('/plugins/Morpheus/images/logo.svg', (req, res) =>
  res.redirect('/matomo/plugins/Morpheus/images/logo.svg?matomo')
);
app.get('/index.php', (req, res) => res.redirect('/matomo/index.php'));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…