Hi guys, I have a stupid Question :slightly_smilin...
# community
m
Hi guys, I have a stupid Question 🙂. I understand how the policies work and how I can limit the acces to a specific resource/page/action using policies / roles etc. I want to build an intranet app, where the navbar/menu is of course different for each role. E.g. the admin role can see more buttons/links on the navbaer/menu than a normal user. The question is ... how can I "generate" the menu depending on the user role / level ? Thanks in advance for any idea.
🙌 1
a
Hi Mike, not a stupid question at all, indeed it's a common requirement. I feel like we were going to add something to the docs about strategies for this but I can't find anything at the moment - will chase that up. Cerbos Hub's embedded PDPs allow you to directly evaluate your policies in the browser, which would allow you to filter the menus based on the user's permissions. Alternatively, I've previously recommended an approach of adding a
permissions
field to your backend API, which you can populate by calling Cerbos's
CheckResources
API from your backend with multiple actions. The UI can then filter the menu based on the
permissions
you send.
m
Thanks @Andrew Haines (Cerbos) - i will take a look, I have to figure out how it works. Maybe a how-to or a blog post on this would help the community. Many thanks again for your reply!
👍🏼 1
a
I've raised a PR to add this to the docs 🙂 https://github.com/cerbos/cerbos/pull/2038
m
💚