mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: Make action ctx-values from reactor-ctx take precedence if set. (#1308)
This commit is contained in:
parent
f2169c9acf
commit
e9d8928bb6
8 changed files with 67 additions and 9 deletions
|
@ -9,9 +9,13 @@ defmodule Ash.Reactor.ActionStep do
|
|||
|
||||
@doc false
|
||||
@impl true
|
||||
def run(arguments, _context, options) do
|
||||
def run(arguments, context, options) do
|
||||
action_input_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
@ -27,9 +31,13 @@ defmodule Ash.Reactor.ActionStep do
|
|||
|
||||
@doc false
|
||||
@impl true
|
||||
def undo(record, arguments, _context, options) do
|
||||
def undo(record, arguments, context, options) do
|
||||
action_input_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
|
@ -38,6 +38,10 @@ defmodule Ash.Reactor.BulkCreateStep do
|
|||
:upsert_identity,
|
||||
:upsert?
|
||||
])
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|> maybe_set_kw(:notification_metadata, arguments[:notification_metadata])
|
||||
|
@ -68,10 +72,15 @@ defmodule Ash.Reactor.BulkCreateStep do
|
|||
|
||||
@doc false
|
||||
@impl true
|
||||
def undo(bulk_result, arguments, _context, options) when is_struct(bulk_result, BulkResult) do
|
||||
def undo(bulk_result, arguments, context, options) when is_struct(bulk_result, BulkResult) do
|
||||
action_options =
|
||||
options
|
||||
|> Keyword.take([:authorize?, :domain])
|
||||
|> Keyword.take([:domain])
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ defmodule Ash.Reactor.BulkUpdateStep do
|
|||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|> maybe_set_kw(:notification_metadata, arguments[:notification_metadata])
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|
||||
success_states =
|
||||
options[:success_state]
|
||||
|
@ -74,10 +78,15 @@ defmodule Ash.Reactor.BulkUpdateStep do
|
|||
|
||||
@doc false
|
||||
@impl true
|
||||
def undo(bulk_result, arguments, _context, options) when is_struct(bulk_result, BulkResult) do
|
||||
def undo(bulk_result, arguments, context, options) when is_struct(bulk_result, BulkResult) do
|
||||
action_options =
|
||||
options
|
||||
|> Keyword.take([:authorize?, :domain])
|
||||
|> Keyword.take([:domain])
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ defmodule Ash.Reactor.CreateStep do
|
|||
def run(arguments, context, options) do
|
||||
changeset_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:upsert_identity, options[:upsert_identity])
|
||||
|> maybe_set_kw(:upsert?, options[:upsert?])
|
||||
|
@ -57,6 +61,10 @@ defmodule Ash.Reactor.CreateStep do
|
|||
def undo(record, arguments, context, options) do
|
||||
changeset_options =
|
||||
[]
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
|
@ -14,6 +14,10 @@ defmodule Ash.Reactor.DestroyStep do
|
|||
|
||||
changeset_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
@ -49,9 +53,13 @@ defmodule Ash.Reactor.DestroyStep do
|
|||
|
||||
@doc false
|
||||
@impl true
|
||||
def undo(record, arguments, _context, options) do
|
||||
def undo(record, arguments, context, options) do
|
||||
changeset_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
|
@ -7,9 +7,13 @@ defmodule Ash.Reactor.ReadOneStep do
|
|||
|
||||
alias Ash.Query
|
||||
|
||||
def run(arguments, _context, options) do
|
||||
def run(arguments, context, options) do
|
||||
query_options =
|
||||
options
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
|
@ -7,9 +7,13 @@ defmodule Ash.Reactor.ReadStep do
|
|||
|
||||
alias Ash.Query
|
||||
|
||||
def run(arguments, _context, options) do
|
||||
def run(arguments, context, options) do
|
||||
query_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
|
@ -12,6 +12,10 @@ defmodule Ash.Reactor.UpdateStep do
|
|||
def run(arguments, context, options) do
|
||||
changeset_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
@ -44,6 +48,10 @@ defmodule Ash.Reactor.UpdateStep do
|
|||
def undo(record, arguments, context, options) do
|
||||
changeset_options =
|
||||
options
|
||||
|> maybe_set_kw(:authorize?, context[:authorize?])
|
||||
|> maybe_set_kw(:actor, context[:actor])
|
||||
|> maybe_set_kw(:tenant, context[:tenant])
|
||||
|> maybe_set_kw(:tracer, context[:tracer])
|
||||
|> maybe_set_kw(:authorize?, options[:authorize?])
|
||||
|> maybe_set_kw(:actor, arguments[:actor])
|
||||
|> maybe_set_kw(:tenant, arguments[:tenant])
|
||||
|
|
Loading…
Reference in a new issue