relates_to_actor_attribute_via
I have a resource called Actor that is not backed by the database, it looks something like this:
The user will always be set, and the role will sometimes be set.
I want to be able to write policies for both cases. What I have done up until now is pass either the user or the role to
My preferred choice has always been to pass the actual actor record to
I now need to add more data to my Actor resource, and have it available in a custom read, so I am looking for a way to make it work.
First I looked for a way to set some context at the same place I call
I am considering a new check
The other possible solution is having a way to specify arbitrary context on the connection that is passed to read actions, etc in the same way actor is.
Any thoughts on these approaches?
The user will always be set, and the role will sometimes be set.
I want to be able to write policies for both cases. What I have done up until now is pass either the user or the role to
Ash.PlugHelpers.set_actor(), which lets me write policies like this:My preferred choice has always been to pass the actual actor record to
Ash.PlugHelpers.set_actor() instead of user or role, however I wasn't able to get this to work with relates_to_actor_via.I now need to add more data to my Actor resource, and have it available in a custom read, so I am looking for a way to make it work.
First I looked for a way to set some context at the same place I call
set_actor however it looks like that context is not passed into a custom read.I am considering a new check
relates_to_actor_attribute_via. That way I can pass my full actor record to set_actor and write my policies on the necessary actor attribute.The other possible solution is having a way to specify arbitrary context on the connection that is passed to read actions, etc in the same way actor is.
Any thoughts on these approaches?
