Ash policies breakdown not showing help_text
I have this policy (check if the role theyre trying to change the user into is super_admin and if theyre not a super_admin themselves block them)
it fails with this error
and this is my dev.exs relevant config
Why am I not seing the helper text? Also why can't I access the roles args? or why is my policy not evaluated? This is on a normal liveview, the user IS super_admin, and I have commented out all other policies, (except the AshAuthentication) so I am not sure why its returning forbidden, the user I am trying to modify as a test is myself, also, according to docs I should use
^arg()
but whenever I try that I get that its not defined, am I missing an import? aside from the config like this in the ash.Resource 21 Replies
Hmm... not sure about the help_text not working, you may need to show an issue
But for args, you need
^arg(:role)
I'll clean deps and try later to see if I can repeat the logs issues, but right now the
^arg()
I get this error
in plural args, I also get this
and the log message does show the atom in place of the role so its not that role is not an atom^arg(:foo)
Hmmm
like singular, not args
Yeah yeah, arg singular gives me the first long message
And args plural doesnβt compile
Hmm...are you fully up to date on your deps?
this is the action in case it helps as well
I believe so
I'll run a clean and update just in case
whats the stack trace for that issue?
heres the full log
No update was needed, everything was up to date
Decided to simplify it even further, to simply dont allow super_admin to be assigned, to simply see if it was in the action directly or in the policy check but I got the same error
Can I see the code where you are calling this? Something is clearly going wrong
Sure sure, its a liveview form, let me send the relevant snippets
this is the form
the handle event
and the form assignment theres another form in the page but the @account_form is the one I am using, the other forms params come as "teams" and this one come as "form"
Seems pretty straight forward...
is this a private code base?
Or something you could share?
I might need a reproduction
Its probably an easy fix, somewhere we're passing
opts
when we should be passing the args etc.sadly it is a private repo, I'll see if I can create a small reproduction later tonight or tomorrow
πββοΈ
Finally got a chance to make it, here it is https://github.com/Alt-iOS/simple_demo
GitHub
GitHub - Alt-iOS/simple_demo: bug in policies in ash
bug in policies in ash. Contribute to Alt-iOS/simple_demo development by creating an account on GitHub.
Its the bare minimum to get the error I was getting before and also should fail to print the help text
So two birds with one stone
nice. Please open an issue on
ash
w/ that repro and any other relevant info πββοΈOf course, and thank you for all the help!!
Solution
fixed
Thanks a lot man!