mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 21:13:10 +12:00
chore: don't use opts[:resource]
in relates to actor via check
This commit is contained in:
parent
4b749c4d1b
commit
8275c5c635
2 changed files with 4 additions and 4 deletions
|
@ -9,10 +9,10 @@ defmodule Ash.Policy.Check.RelatesToActorVia do
|
|||
end
|
||||
|
||||
@impl true
|
||||
def filter(_actor, _context, opts) do
|
||||
def filter(_actor, context, opts) do
|
||||
opts = Keyword.update!(opts, :relationship_path, &List.wrap/1)
|
||||
actor_field = Keyword.get(opts, :field)
|
||||
{last_relationship, to_many?} = relationship_info(opts[:resource], opts[:relationship_path])
|
||||
{last_relationship, to_many?} = relationship_info(context.resource, opts[:relationship_path])
|
||||
|
||||
pkey =
|
||||
last_relationship.destination
|
||||
|
@ -44,7 +44,7 @@ defmodule Ash.Policy.Check.RelatesToActorVia do
|
|||
@impl true
|
||||
def reject(actor, context, opts) do
|
||||
opts = Keyword.update!(opts, :relationship_path, &List.wrap/1)
|
||||
{last_relationship, to_many?} = relationship_info(opts[:resource], opts[:relationship_path])
|
||||
{last_relationship, to_many?} = relationship_info(context.resource, opts[:relationship_path])
|
||||
|
||||
pkey =
|
||||
last_relationship.destination
|
||||
|
|
|
@ -350,7 +350,7 @@ defmodule Ash.Policy.FilterCheck do
|
|||
_ -> nil
|
||||
end
|
||||
|
||||
opts = Keyword.put_new(opts, :resource, authorizer.resource)
|
||||
opts = Keyword.update(opts, :resource, authorizer.resource, &(&1 || authorizer.resource))
|
||||
|
||||
{:ok,
|
||||
actor
|
||||
|
|
Loading…
Reference in a new issue