Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ash/resource/change/cascade_destroy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ defmodule Ash.Resource.Change.CascadeDestroy do

defp destroy_related([], _, _, _), do: :ok

defp destroy_related(data, opts, %{tenant: tenant} = context, changeset) do
defp destroy_related(data, opts, context, changeset) do
action = opts.action
relationship = opts.relationship

Expand Down Expand Up @@ -346,7 +346,7 @@ defmodule Ash.Resource.Change.CascadeDestroy do
|> List.wrap()
|> Ash.load!(
[{relationship.name, load_query}],
tenant: tenant
Ash.Context.to_opts(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do:
scope: context, but we should also do authorize?: false, so scope: context, authorize?: false to retain original behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't authorized?: false removed intentionally in favor of having accessing_from set and having policies?

you didn't explicitly answer the question, but you merged the PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah you're right 👍 maybe a comment here saying that this is meant to run authorization.

)
|> Enum.flat_map(fn record ->
record
Expand Down
4 changes: 2 additions & 2 deletions lib/ash/resource/change/cascade_update.ex
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ defmodule Ash.Resource.Change.CascadeUpdate do

defp update_related(_, [], _, _), do: :ok

defp update_related(changeset, data, opts, %{tenant: tenant} = context) do
defp update_related(changeset, data, opts, context) do
action = opts.action
relationship = opts.relationship
copies = opts.copy_inputs
Expand Down Expand Up @@ -260,7 +260,7 @@ defmodule Ash.Resource.Change.CascadeUpdate do
|> List.wrap()
|> Ash.load!(
[{relationship.name, load_query}],
tenant: tenant
Ash.Context.to_opts(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

)
|> Enum.flat_map(fn record ->
record
Expand Down