mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
34 lines
801 B
TypeScript
34 lines
801 B
TypeScript
import type {ReactNode} from 'react';
|
|
|
|
import Access from 'sentry/components/acl/access';
|
|
import {Alert} from 'sentry/components/alert';
|
|
import {t} from 'sentry/locale';
|
|
import type {Scope} from 'sentry/types';
|
|
|
|
type Props = React.ComponentPropsWithoutRef<typeof Alert> & {
|
|
access?: Scope[];
|
|
message?: ReactNode;
|
|
};
|
|
|
|
function PermissionAlert({
|
|
access = ['org:write'],
|
|
message = t(
|
|
'These settings can only be edited by users with the organization owner or manager role.'
|
|
),
|
|
...props
|
|
}: Props) {
|
|
return (
|
|
<Access access={access}>
|
|
{({hasAccess}) =>
|
|
!hasAccess && (
|
|
<Alert data-test-id="org-permission-alert" type="warning" showIcon {...props}>
|
|
{message}
|
|
</Alert>
|
|
)
|
|
}
|
|
</Access>
|
|
);
|
|
}
|
|
|
|
export default PermissionAlert;
|