Skip to content

Commit

Permalink
fix: include changeset in preflight authorization context
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Dec 16, 2024
1 parent 00891f8 commit d62ae46
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/ash/policy/filter_check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ defmodule Ash.Policy.FilterCheck do
changeset: %Ash.Changeset{data: data, tenant: tenant} = changeset,
actor: actor
}) do
expression =
Ash.Expr.fill_template(
expression,
actor,
changeset.arguments,
changeset.context,
changeset
)

case Ash.Filter.hydrate_refs(expression, %{
resource: resource,
aggregates: %{},
Expand Down Expand Up @@ -274,12 +283,6 @@ defmodule Ash.Policy.FilterCheck do
end
end

defp no_related_references?(expression) do
expression
|> Ash.Filter.list_refs()
|> Enum.any?(&(&1.relationship_path != []))
end

def auto_filter(actor, authorizer, opts) do
opts = Keyword.put_new(opts, :resource, authorizer.resource)

Expand Down

0 comments on commit d62ae46

Please sign in to comment.