How to Compute Permissions
What is the recommended way to design a permissions data structure—based on policies—that can serve as the source of truth for conditional UI rendering? (I am using React via Inertia)
Solution:Jump to solution
in Elixir-land we have
Ash.can?
and code interfaces have can_<name>?
generated6 Replies
Honestly there are a million and one ways under the sun, its really hard to say
Solution
in Elixir-land we have
Ash.can?
and code interfaces have can_<name>?
generatedso you could just pass those up to the view from your backend potentially 🙂
Oh nice, I didn't know about that
can_<name>
Then I'll just pass a map like this
Works for my use case
Could you give an example of how Ash.can?
works? Tried to use it before but couldn't find any exampleI believe there are examples in the testing guide (which is just one way to use it)
https://hexdocs.pm/ash/test-resources.html#write-some-tests
Mm no couldn't find any specific to
Ash.can?