Anonymous after_action change doesn't receive actor?

 change after_action(fn changeset, record, context ->
      IO.inspect(context)

      {:ok, record}
   end)

Produces

%Ash.Resource.Change.Context{
  actor: nil,
  tenant: "null",
  authorize?: false,
  tracer: nil,
  bulk?: false
}

This is similar to this issue but I’m using the anonymous function version and don’t have options. Perhaps the answer is I have to create a change module and receive the actor via opts?

I know the actor is present. I have a user set in ash_admin and know the actor is being set because the policy that requires actor_present() fails if I unlock it.

:thinking: When you click on the play button does it work? That is a very confusing UI :laughing:

Yes! Yes it does. Thank you

1 Like

Yeah, so the “play button” means “act as this user”, the lock means “do authorization”.

1 Like

That explains why the policies were being applied but the actor wasn’t in the context. :+1: