mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 21:43:02 +12:00
20 lines
477 B
Elixir
20 lines
477 B
Elixir
defmodule Ash.Policy.Check.Selecting do
|
|
@moduledoc false
|
|
use Ash.Policy.SimpleCheck
|
|
|
|
@impl true
|
|
def describe(opts) do
|
|
"selecting #{opts[:attribute]}"
|
|
end
|
|
|
|
@impl true
|
|
def match?(_actor, %{changeset: %Ash.Changeset{} = changeset}, opts) do
|
|
Ash.Changeset.selecting?(changeset, opts[:attribute])
|
|
end
|
|
|
|
def match?(_actor, %{query: %Ash.Query{} = query}, opts) do
|
|
Ash.Query.selecting?(query, opts[:attribute])
|
|
end
|
|
|
|
def match?(_, _, _), do: false
|
|
end
|