permissionAlert.tsx 692 B

12345678910111213141516171819202122
  1. import Access from 'sentry/components/acl/access';
  2. import Alert from 'sentry/components/alert';
  3. import {t} from 'sentry/locale';
  4. type Props = React.ComponentPropsWithoutRef<typeof Alert> &
  5. Pick<React.ComponentProps<typeof Access>, 'access'>;
  6. const PermissionAlert = ({access = ['project:write'], ...props}: Props) => (
  7. <Access access={access}>
  8. {({hasAccess}) =>
  9. !hasAccess && (
  10. <Alert data-test-id="project-permission-alert" type="warning" {...props}>
  11. {t(
  12. 'These settings can only be edited by users with the organization owner, manager, or admin role.'
  13. )}
  14. </Alert>
  15. )
  16. }
  17. </Access>
  18. );
  19. export default PermissionAlert;