Best option to read a relationship which has policy in Action
Hi, I so much searching today and with AI to be allowed load a relations in action, but i think there is better way!
for example in user resource
So i added this Policy in resource
So it let me to to get the data of
I tried to add
But it did not work and return empty list
I think this (
Thank you in advance!
for example in user resource
get_by_subject I added this:permissions is a many_to_manySo i added this Policy in resource
b and cSo it let me to to get the data of
permissions before it it just return empty list []I tried to add
authorize?: false To |> Ash.Query.load([:permissions, :permission_values], authorize?: false)But it did not work and return empty list
I think this (
authorize_if expr(not is_nil(^context(:accessing_from)))) way can be a problem for me base on a mistake leak the dataThank you in advance!
Solution
Finally i found :)) i created this debugger


in my user
inside MishkaCms.Accounts.Permission
and
in my user
inside MishkaCms.Accounts.Permission
and
MishkaCms.Accounts.UserPermission