update :confirm_phone_number do alias Actions.ConfirmPhoneNumber.Changes accept [] argument :code, :string, allow_nil?: false change Changes.VerifyCode change set_attribute(:confirmed_at, DateTime.utc_now()) change Changes.SendEmail end
update :confirm_phone_number do alias Actions.ConfirmPhoneNumber.Changes accept [] argument :code, :string, allow_nil?: false change Changes.VerifyCode change set_attribute(:confirmed_at, DateTime.utc_now()) change Changes.SendEmail end
And also this policy for it:
alias Marketplace.Accounts.User.Checks bypass AshAuthentication.Checks.AshAuthenticationInteraction do authorize_if always() end policy action(:confirm_phone_number) do forbid_unless Checks.NotConfirmedYet authorize_if always() end
alias Marketplace.Accounts.User.Checks bypass AshAuthentication.Checks.AshAuthenticationInteraction do authorize_if always() end policy action(:confirm_phone_number) do forbid_unless Checks.NotConfirmedYet authorize_if always() end
I expect that the
NotConfirmedYet
NotConfirmedYet
policy will be called when running
User.confirm_phone_number(user, %{code: "1234"})
User.confirm_phone_number(user, %{code: "1234"})
, but it isn't.
I'm pretty sure this was working before, so I'm not sure if it is a bug in the new versions of Ash (I'm using the latest 2.9.11) or something else I messed up.
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.