Bypass not applying - had to pass actor again in load

Hi! I fought with this for an embarrassingly long time so I'm just gonna stick it here for SEO posterity. I thought my superuser/staff bypass was inexplicably failing – it's at the top, what's the deal??? – but it turns out the policy system just wasn't seeing my actor at all where I assumed it was. I had to pass the actor in again on the load! call. not sure if there's a better way to do this type of thing but this is what's working now:
Site.read_all!(actor: socket.assigns.current_user)
|> Panacea.Sites.load!([:domains, :profiles, :configuration, :users],
actor: socket.assigns.current_user # <- had to add this line to fix the issue
)
Site.read_all!(actor: socket.assigns.current_user)
|> Panacea.Sites.load!([:domains, :profiles, :configuration, :users],
actor: socket.assigns.current_user # <- had to add this line to fix the issue
)
To be clear, my system is functioning now, just wanted to leave a note in case anyone else is ever bashing their head into the same thing I was. thanks i love ash
1 Reply
ZachDaniel
ZachDaniel2y ago
Thanks so much for reporting this so other users can find it 🙇‍♂️

Did you find this page helpful?