permissionDenied.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {useEffect} from 'react';
  2. import * as Sentry from '@sentry/react';
  3. import * as Layout from 'sentry/components/layouts/thirds';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import LoadingError from 'sentry/components/loadingError';
  6. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  7. import {t, tct} from 'sentry/locale';
  8. import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes';
  9. import {useRoutes} from 'sentry/utils/useRoutes';
  10. const ERROR_NAME = 'Permission Denied';
  11. function PermissionDenied() {
  12. const routes = useRoutes();
  13. useEffect(() => {
  14. const route = getRouteStringFromRoutes(routes);
  15. Sentry.addBreadcrumb({
  16. category: 'auth',
  17. message: `${ERROR_NAME}${route ? ` : ${route}` : ''}`,
  18. level: 'error',
  19. });
  20. // eslint-disable-next-line react-hooks/exhaustive-deps
  21. }, []);
  22. return (
  23. <SentryDocumentTitle title={t('Permission Denied')}>
  24. <Layout.Page withPadding>
  25. <LoadingError
  26. message={tct(
  27. `Your role does not have the necessary permissions to access this
  28. resource, please read more about [link:organizational roles]`,
  29. {
  30. link: (
  31. <ExternalLink href="https://docs.sentry.io/product/accounts/membership/" />
  32. ),
  33. }
  34. )}
  35. />
  36. </Layout.Page>
  37. </SentryDocumentTitle>
  38. );
  39. }
  40. export default PermissionDenied;