✨(frontend) restrict mailbox creation
- update mailbox creation feature by introducing the use of new mail domain ability field to hide or show mailbox creation button - update related e2e tests
This commit is contained in:
committed by
Sebastien Nobour
parent
14deca13f4
commit
45dbdd6c4c
@@ -91,6 +91,7 @@ export function MailDomainsContent({ mailDomain }: { mailDomain: MailDomain }) {
|
||||
<TopBanner
|
||||
name={mailDomain.name}
|
||||
setIsFormVisible={setIsCreateMailboxFormVisible}
|
||||
abilities={mailDomain.abilities}
|
||||
/>
|
||||
<Card
|
||||
$padding={{ bottom: 'small' }}
|
||||
@@ -127,9 +128,11 @@ export function MailDomainsContent({ mailDomain }: { mailDomain: MailDomain }) {
|
||||
const TopBanner = ({
|
||||
name,
|
||||
setIsFormVisible,
|
||||
abilities,
|
||||
}: {
|
||||
name: string;
|
||||
setIsFormVisible: (value: boolean) => void;
|
||||
abilities: MailDomain['abilities'];
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -147,12 +150,14 @@ const TopBanner = ({
|
||||
</Text>
|
||||
</Box>
|
||||
<Box $margin={{ all: 'big', bottom: 'small' }} $align="flex-end">
|
||||
<Button
|
||||
aria-label={t(`Create a mailbox in {{name}} domain`, { name })}
|
||||
onClick={() => setIsFormVisible(true)}
|
||||
>
|
||||
{t('Create a mailbox')}
|
||||
</Button>
|
||||
{abilities.post ? (
|
||||
<Button
|
||||
aria-label={t(`Create a mailbox in {{name}} domain`, { name })}
|
||||
onClick={() => setIsFormVisible(true)}
|
||||
>
|
||||
{t('Create a mailbox')}
|
||||
</Button>
|
||||
) : null}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,14 @@ export interface MailDomain {
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
slug: string;
|
||||
abilities: {
|
||||
get: boolean;
|
||||
patch: boolean;
|
||||
put: boolean;
|
||||
post: boolean;
|
||||
delete: boolean;
|
||||
manage_accesses: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface MailDomainMailbox {
|
||||
|
||||
Reference in New Issue
Block a user