Current section

Files

Jump to
ash_policy_authorizer lib ash_policy_authorizer check attribute.ex
Raw

lib/ash_policy_authorizer/check/attribute.ex

defmodule AshPolicyAuthorizer.Check.Attribute do
@moduledoc "This check is true when a field on the record matches a specific filter"
use AshPolicyAuthorizer.FilterCheck
@impl true
def describe(opts) do
"record.#{opts[:attribute]} matches #{inspect(opts[:filter])}"
end
@impl true
def filter(opts) do
[{opts[:attribute], opts[:filter]}]
end
end