permissionAlert.tsx 894 B

12345678910111213141516171819202122232425262728
  1. import Access from 'sentry/components/acl/access';
  2. import {Alert} from 'sentry/components/alert';
  3. import {t} from 'sentry/locale';
  4. import {Project, Scope, Team} from 'sentry/types';
  5. interface Props extends React.ComponentPropsWithoutRef<typeof Alert> {
  6. access?: Scope[];
  7. project?: Project | null | undefined;
  8. team?: Team | null | undefined;
  9. }
  10. function PermissionAlert({access = ['project:write'], project, team, ...props}: Props) {
  11. return (
  12. <Access access={access} project={project} team={team}>
  13. {({hasAccess}) =>
  14. !hasAccess && (
  15. <Alert data-test-id="project-permission-alert" type="warning" {...props}>
  16. {t(
  17. 'These settings can only be edited by users with the organization-level owner, manager, or team-level admin roles.'
  18. )}
  19. </Alert>
  20. )
  21. }
  22. </Access>
  23. );
  24. }
  25. export default PermissionAlert;