roles control on actions
Hi all, I am trying to RBAC actions in a page. I have an array of roles as string for each user. I have a custom hook to check roles:
I am then using the hook to conditonally render buttons, etc in the UI:
Does this seem like a good implementation, is there a better way to do it?
2 Replies
If you call this hook multiple times, it will make multiple http requests. You should probably cache the list of roles after the first request
Also if you use
/app
it will be better to get the roles in a server componentThanks that's a good point. 👍