Skip to content

Commit 22a5e3c

Browse files
committed
add explication text for tab, panel, step, section
1 parent 3f7a645 commit 22a5e3c

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

docs/AuthRBAC.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ const ProductShow = () => (
632632

633633
Replacement for the `<TabbedShowLayout.Tab>` that only renders a tab if the user has the right permissions.
634634

635-
Add a `name` prop to the `<Tab>` so you can reference it in the permissions.
635+
Add a `name` prop to the `<Tab>` so you can reference it in the permissions.
636636
Then, to allow users to access a particular `<Tab>`, update the permissions definition as follows: `{ action: 'read', resource: '{RESOURCE}.tab.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<Tab>`.
637637

638638
> For instance, to allow users access to the following tab `<Tab label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'read', resource: 'products.tab.description' }`.
@@ -802,7 +802,10 @@ const ProductEdit = () => (
802802

803803
Replacement for the default `<FormTab>` that only renders a tab if the user has the right permissions.
804804

805-
Add a `name` prop to the `FormTab` to define the sub-resource that the user needs to have the right permissions for.
805+
Add a `name` prop to the `<FormTab>` so you can reference it in the permissions.
806+
Then, to allow users to access a particular `<FormTab>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.tab.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<FormTab>`.
807+
808+
> For instance, to allow users access to the following tab `<FormTab label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.tab.description' }`.
806809
807810
`<FormTab>` also only renders the child inputs for which the user has the 'write' permissions.
808811

@@ -914,7 +917,12 @@ const ProductEdit = () => (
914917
### `<AccordionFormPanel>`
915918

916919
Replacement for the default `<AccordionFormPanel>` that only renders a section if the user has the right permissions.
917-
Add a `name` prop to the `AccordionFormPanel` to define the sub-resource that the user needs to have the right permissions for.
920+
921+
Add a `name` prop to the `<AccordionFormPanel>` so you can reference it in the permissions.
922+
Then, to allow users to access a particular `<AccordionFormPanel>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.panel.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<FormTab>`.
923+
924+
> For instance, to allow users access to the following tab `<AccordionFormPanel label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.panel.description' }`.
925+
918926
`<AccordionFormPanel>` also only renders the child inputs for which the user has the 'write' permissions.
919927

920928
To learn more about the permissions format, please refer to the [`@react-admin/ra-rbac` documentation](https://marmelab.com/ra-enterprise/modules/ra-rbac).
@@ -969,7 +977,12 @@ const ProductEdit = () => (
969977
### `<AccordionSection>`
970978

971979
Replacement for the default `<AccordionSection>` that only renders a section if the user has the right permissions.
972-
Add a `name` prop to the `AccordionSection` to define the sub-resource that the user needs to have the right permissions for.
980+
981+
Add a `name` prop to the `<AccordionSection>` so you can reference it in the permissions.
982+
Then, to allow users to access a particular `<AccordionSection>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.section.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<AccordionSection>`.
983+
984+
> For instance, to allow users access to the following tab `<AccordionSection label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.section.description' }`.
985+
973986
`<AccordionSection>` also only renders the child inputs for which the user has the 'write' permissions.
974987

975988
This component is provided by the `@react-admin/ra-enterprise` package.
@@ -1086,7 +1099,12 @@ const ProductEdit = () => (
10861099
### `<LongFormSection>`
10871100

10881101
Replacement for the default `<LongFormSection>` that only renders a section if the user has the right permissions.
1089-
Add a `name` prop to the `LongFormSection` to define the sub-resource that the user needs to have the right permissions for.
1102+
1103+
Add a `name` prop to the `<LongFormSection>` so you can reference it in the permissions.
1104+
Then, to allow users to access a particular `<LongFormSection>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.panel.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<LongFormSection>`.
1105+
1106+
> For instance, to allow users access to the following tab `<LongFormSection label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.panel.description' }`.
1107+
10901108
`<LongFormSection>` also only renders the child inputs for which the user has the 'write' permissions.
10911109

10921110
This component is provided by the `@react-admin/ra-enterprise` package.
@@ -1207,7 +1225,11 @@ Use it with `<WizardForm>` from `@react-admin/ra-enterprise` to only display the
12071225

12081226
This component is provided by the `@react-admin/ra-enterprise` package.
12091227

1210-
Add a `name` prop to the WizardFormStep to define the sub-resource that the user needs to have the right permissions for.
1228+
Add a `name` prop to the `<WizardFormStep>` so you can reference it in the permissions.
1229+
Then, to allow users to access a particular `<WizardFormStep>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.step.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<WizardFormStep>`.
1230+
1231+
> For instance, to allow users access to the following tab `<WizardFormStep label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.step.description' }`.
1232+
12111233
`<WizardFormStep>` also only renders the child inputs for which the user has the 'write' permissions.
12121234

12131235
To learn more about the permissions format, please refer to the [`@react-admin/ra-rbac` documentation](https://marmelab.com/ra-enterprise/modules/ra-rbac).

0 commit comments

Comments
 (0)