# `Permit.Ecto.Resolver`
[🔗](https://github.com/curiosum-dev/permit_ecto/blob/v0.3.0/lib/permit_ecto/resolver.ex#L1)

Implementation of `Permit.ResolverBase` behaviour, resolving and checks authorization of records or lists of records based on automatic Ecto query construction, taking parameters as input and `:base_query` and `:finalize_query` functions as means to transform the query based on e.g. current controller context.

For a resolver implementation not using Ecto for fetching resources, see `Permit.Resolver` from the `permit` library.

The usage of `Permit.Ecto.Resolver` as opposed to `Permit.Resolver` in `permit_ecto` library occurs because in the `m:Permit.Ecto.__using__/1` macro the `resolver_module/0` function is overridden to point to `Permit.Ecto.Resolver`.

This module is to be considered a private API of the authorization framework.
It should not be directly used by application code, but rather by wrappers
providing integration with e.g. Plug or LiveView.

# `authorize_and_preload_all!`

```elixir
@spec authorize_and_preload_all!(
  Permit.Types.subject(),
  module(),
  Permit.Types.resource_module(),
  Permit.Types.action_group(),
  map()
) :: {:authorized, [struct()]} | :unauthorized | {:not_found, term()}
```

# `authorize_and_preload_one!`

```elixir
@spec authorize_and_preload_one!(
  Permit.Types.subject(),
  module(),
  Permit.Types.resource_module(),
  Permit.Types.action_group(),
  map()
) :: {:authorized, [struct()]} | :unauthorized
```

# `authorized?`

```elixir
@spec authorized?(
  Permit.Types.subject(),
  module(),
  Permit.Types.object_or_resource_module(),
  Permit.Types.action_group()
) :: boolean()
```

---

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