# `Ash.Policy.SimpleCheck`
[🔗](https://github.com/ash-project/ash/blob/v3.23.1/lib/ash/policy/simple_check.ex#L5)

A type of check that operates only on request context, never on the data

Define `c:match?/3`, which gets the actor, request context, and opts, and returns true or false

## Example

This is a simple check that checks if the user is changing anything other than the
provided list.

```elixir
defmodule ChangingNothingExcept do
  use Ash.Policy.SimpleCheck

  def match?(_actor, %{subject: %Ash.Changeset{} = changeset}, opts) do
    allowed = opts[:attributes]
    {:ok, Enum.all?(Map.keys(changeset.attributes), &(&1 in allowed))}
  end

  def match?(_, _, _), do: {:ok, true}
end
```

You could then use this like

```elixir
policy actor_attribute_equals(:role, :foobar) do
  authorize_if {ChangingNothingExcept, attributes: [:foo, :bar]}
end
```

# `actor`

```elixir
@type actor() :: Ash.Policy.Check.actor()
```

# `context`

```elixir
@type context() :: Ash.Policy.Authorizer.t()
```

# `options`

```elixir
@type options() :: Keyword.t()
```

# `match?`

```elixir
@callback match?(actor(), context(), options()) ::
  boolean() | {:ok, boolean()} | {:error, term()}
```

Whether or not the request matches the check

---

*Consult [api-reference.md](api-reference.md) for complete listing*
