You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You don't have to provide an `action` if you just want to know whether users can access the CRUD pages of a resource. This is useful to leverage `canAccess` in an `<Admin>` component children function:
68
+
If you just want to know whether users can access any of the resources, you don't have to provide an `action`. For instance, here's how you may display different components depending on resources access rights in the dashboard:
In this example, users will see the products list and will be able to click on its category link to edit the category. However, they won't see the categories list nor the commands list.
121
+
In this example, users will see the list of last products and the list of last categories but they won't be able to see the list of last orders.
122
+
107
123
108
-
Note that [ra-rbac's `<Resource>` component](./AuthRBAC.md#resource)does this check automatically, so you don't actually need to use `canAccess`in this case.
124
+
**Note**: [ra-rbac's `<Resource>` component](./AuthRBAC.md#resource)automatically checks for the `list`, `show`, `create` and `edit` actions, so you don't actually need to use `canAccess`if you want to restrict a whole resource.
109
125
110
126
```tsx
111
127
import { Admin, ListGuesser, EditGuesser } from'react-admin'; // do not import Resource here
0 commit comments