AshOban and Policies

I noticed that on initial project which has policies:
policies do
bypass AshAuthentication.Checks.AshAuthenticationInteraction do
authorize_if always()
end

policy always() do
forbid_if always()
end
end
policies do
bypass AshAuthentication.Checks.AshAuthenticationInteraction do
authorize_if always()
end

policy always() do
forbid_if always()
end
end
if I call an action that has change run_oban_trigger(:my_trigger) with authorize?: false as an option; nothing happens regarding the oban job. Also nothing is reported. How should I go about this? 🤔
Solution:
bypass AshObanInteraction do
authorize_if always()
end
bypass AshObanInteraction do
authorize_if always()
end
...
Jump to solution
12 Replies
ken-kost
ken-kostOP•4mo ago
I can remove the policies and authorizes for this case, I'm doing a simple tutorial. But I'm wondering what would be the way if I had policies. Also, it's tricky to figure this out, what could be done in regards to that?
ZachDaniel
ZachDaniel•4mo ago
🤔 that shouldn't have anything to do with it You're saying the action succeeds but the oban job isn't triggered?
ken-kost
ken-kostOP•4mo ago
yes but if I remove the auth stuff it works as expected
ZachDaniel
ZachDaniel•4mo ago
🤔
ken-kost
ken-kostOP•4mo ago
yea this is weird should I try to make a reproduction repo?
ZachDaniel
ZachDaniel•4mo ago
Ah
Solution
ZachDaniel
ZachDaniel•4mo ago
bypass AshObanInteraction do
authorize_if always()
end
bypass AshObanInteraction do
authorize_if always()
end
ZachDaniel
ZachDaniel•4mo ago
you need that
ken-kost
ken-kostOP•4mo ago
ah yes, I expected some thing like that thanks a bunch hmm, does it make sense to add that policy through igniter when ash_oban is selected? 🤔 talking about initial project through ash hq
ZachDaniel
ZachDaniel•4mo ago
Possibly, but its a bit tough because we wouldn't know which resources you want it on
ken-kost
ken-kostOP•4mo ago
true that
ken-kost
ken-kostOP•4mo ago
but how come there's no log or error that oban job didn't pass the policy, would that be possible? 🤔

Did you find this page helpful?