fix(create-role): check isCreator by default when permissioon is checked
This commit is contained in:
@@ -22,14 +22,22 @@ type PermissionSettingsProps = {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
fieldPrefix: string;
|
fieldPrefix: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
|
open?: boolean;
|
||||||
defaultChecked?: boolean;
|
defaultChecked?: boolean;
|
||||||
actions: IPermissionCatalog['actions'];
|
actions: IPermissionCatalog['actions'];
|
||||||
conditions: IPermissionCatalog['conditions'];
|
conditions: IPermissionCatalog['conditions'];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PermissionSettings(props: PermissionSettingsProps) {
|
export default function PermissionSettings(props: PermissionSettingsProps) {
|
||||||
const { onClose, fieldPrefix, subject, actions, conditions, defaultChecked } =
|
const {
|
||||||
props;
|
onClose,
|
||||||
|
open = false,
|
||||||
|
fieldPrefix,
|
||||||
|
subject,
|
||||||
|
actions,
|
||||||
|
conditions,
|
||||||
|
defaultChecked,
|
||||||
|
} = props;
|
||||||
|
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { getValues, resetField } = useFormContext();
|
const { getValues, resetField } = useFormContext();
|
||||||
@@ -58,7 +66,7 @@ export default function PermissionSettings(props: PermissionSettingsProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open onClose={cancel}>
|
<Dialog open onClose={cancel} sx={{ display: open ? 'block' : 'none' }}>
|
||||||
<DialogTitle>{formatMessage('permissionSettings.title')}</DialogTitle>
|
<DialogTitle>{formatMessage('permissionSettings.title')}</DialogTitle>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
|
@@ -93,16 +93,15 @@ const PermissionCatalogField = ({
|
|||||||
<SettingsIcon />
|
<SettingsIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
{dialogName === subject.key && (
|
<PermissionSettings
|
||||||
<PermissionSettings
|
open={dialogName === subject.key}
|
||||||
onClose={() => setDialogName('')}
|
onClose={() => setDialogName('')}
|
||||||
fieldPrefix={`${name}.${subject.key}`}
|
fieldPrefix={`${name}.${subject.key}`}
|
||||||
subject={subject.key}
|
subject={subject.key}
|
||||||
actions={permissionCatalog.actions}
|
actions={permissionCatalog.actions}
|
||||||
conditions={permissionCatalog.conditions}
|
conditions={permissionCatalog.conditions}
|
||||||
defaultChecked={defaultChecked}
|
defaultChecked={defaultChecked}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
Reference in New Issue
Block a user