https://cerbos.dev logo
#help
Title
# help
n

Norberto Cáceres

06/22/2023, 5:16 PM
Hey, is it a reasonable practice to have actions that correspond to UI components, like for example "VIEW_EDIT_BUTTON"?
c

Charith (Cerbos)

06/22/2023, 5:26 PM
Yes, that's absolutely fine
r

Rasmus Dencker

06/22/2023, 5:55 PM
I'm curious as to why you'd make UI specific actions - can you elaborate your thoughts on that? I'm genuinely interested; I generally try to use verbs that make sense both server- and client side i.e.
EDIT
- so that, if that user is allowed to edit an Article, for instance, you check for the "EDIT" action to determine if you should show the button; and also on the server side when the user attempts to update the article.
n

Norberto Cáceres

06/22/2023, 6:04 PM
That's what I do for cases where there is a 1:1 mapping between the UI component and the server-side action, but I stumbled upon a case where 1 UI component allows the user to interact with N server-side actions, such that I had to either check for access to the N actions to conditionally render the component or have an action that corresponds to the display of the component itself
r

Rasmus Dencker

06/22/2023, 6:50 PM
Got it! That makes sense.
Thanks for elaborating
3 Views