Skip to content

Commit c177f80

Browse files
committed
renamen LongFormSection to LongForm.Section
1 parent ee460e3 commit c177f80

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

docs/AuthRBAC.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,24 +1096,23 @@ const ProductEdit = () => (
10961096
```
10971097
{% endraw %}
10981098

1099-
### `<LongFormSection>`
1099+
### `<LongForm.Section>`
11001100

1101-
Replacement for the default `<LongFormSection>` that only renders a section if the user has the right permissions.
1101+
Replacement for the default `<LongForm.Section>` that only renders a section if the user has the right permissions.
1102+
Use it with `<LongForm>` from `@react-admin/ra-enterprise` to only display the section the user has access to in the form.
11021103

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>`.
1104+
Add a `name` prop to the `<LongForm.Section>` so you can reference it in the permissions.
1105+
Then, to allow users to access a particular `<LongForm.Section>`, 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 `<LongForm.Section>`.
11051106

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+
> For instance, to allow users access to the following tab `<LongForm.Section label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.panel.description' }`.
11071108
1108-
`<LongFormSection>` also only renders the child inputs for which the user has the 'write' permissions.
1109-
1110-
This component is provided by the `@react-admin/ra-enterprise` package.
1109+
`<LongForm.Section>` also only renders the child inputs for which the user has the 'write' permissions.
11111110

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

11141113
{% raw %}
11151114
```tsx
1116-
import { LongForm, LongFormSection } from '@react-admin/ra-enterprise';
1115+
import { LongForm } from '@react-admin/ra-enterprise';
11171116

11181117
const authProvider = {
11191118
// ...
@@ -1136,22 +1135,22 @@ const authProvider = {
11361135
const ProductEdit = () => (
11371136
<Edit>
11381137
<LongForm>
1139-
<LongFormSection name="description" label="Description">
1138+
<LongForm.Section name="description" label="Description">
11401139
<TextInput source="reference" />
11411140
<TextInput source="width" />
11421141
<TextInput source="height" />
11431142
// not displayed
11441143
<TextInput source="description" />
1145-
</LongFormSection>
1146-
<LongFormSection name="images" label="Images">
1144+
</LongForm.Section>
1145+
<LongForm.Section name="images" label="Images">
11471146
// not displayed
11481147
<TextInput source="image" />
11491148
<TextInput source="thumbnail" />
1150-
</LongFormSection>
1149+
</LongForm.Section>
11511150
// not displayed
1152-
<LongFormSection name="stock" label="Stock">
1151+
<LongForm.Section name="stock" label="Stock">
11531152
<TextInput source="stock" />
1154-
</LongFormSection>
1153+
</LongForm.Section>
11551154
</LongForm>
11561155
</Edit>
11571156
);

0 commit comments

Comments
 (0)