Take care if links in a layout are rendered#1
Conversation
|
Hi @mknet! Firstly thanks for the PR and I hope this lib provides some help in your project. Regards to the Considering this problem, my answer is you don't need to take care of it by yourself. As long as you define all routes in the router, for example, if a user with user role who wants to access Then the permission check here react-acl-router/src/AclRouter.jsx Line 63 in c88751f will help prevent the user to access the Hope this answers your question and let me know if there are any other issues. 🙂 |
|
Hey @AlanWei, sorry I haven't answered, yet. I'm very busy the last couple of weeks. As far as I understand you there is only a way to render a component "Unauthorized" when the used tries to access a router he got no authorization for. But my idea in addition is to change the rendering of the links as well. So, that only links to authorized router getting rendered. I know, that there is the idea of UnauthorizedLayout and AuthorizedLayout but I wanna be able to have more options than yes or no. Do you get my idea? |
Hey @AlanWei,
I came up with the idea that the rendering of links should be not only dependent on one layout but also on a specific role. This is why I introduced a Link wrapper which does exactly this.
Please have a look and tell me what you think.
Thanks in advance and regards
Marcel