Menus & access control
How to load at once all menus that a user as access using access control
5 Replies
Hi @Sly. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In Refine, the access control for menus is handled by the
Sider
component. When the Sider
is integrated, it checks for access control and unaccessible resources won't appear in the sider menu.
For example, if your app has a resource called posts
, it will be checked with { resource: "posts", action: "list" }
. If the user has access to this resource, it will appear in the menu. This process is done for all resources, effectively loading all menus that a user has access to at once.
Here is the relevant extract from the documentation:
Sider is integrated, which means that unaccessible resources won't appear in the sider menu. Menu items will check access control withYou can find more information about this in the Refine documentation on Access Control Provider (https://refine.dev/docs/authorization/access-control-provider#list-of-default-access-control-points). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------{ resource, action: "list" }
. For example, if your app has a resource calledposts
, it will be checked with{ resource: "posts", action: "list" }
.
<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
like-gold•5mo ago
@kapa.ai When the network is slow the menus are showing one by one, I want that it to appear all at same time
Let me check the knowledge base for you. One moment! :books:
----------------------
Refine uses React and Ant Design under the hood, and it leverages the concept of "lazy loading" to optimize the performance of your application. This means that certain elements, such as menus, might load one by one when the network is slow.
However, if you want all menus to appear at the same time, you might need to adjust the way your data is fetched or the way your components are rendered. This could involve preloading all necessary data before rendering the menus, or adjusting your React components to only render once all necessary data is available.
Unfortunately, the provided knowledge sources do not contain specific code examples or instructions on how to achieve this in Refine. For more detailed guidance, you might want to refer to the Refine documentation (https://refine.dev/docs/getting-started/introduction) or seek advice from the Refine community.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below