# Cantare

Declarative action authorization library for Elixir, inspired by [CanCanCan](

Provide simple ability rules for your application using idiomatic Elixir patterns, just like this:

defmodule YourApp.Abilities do
  import Cantare.Abilities

  alias YourApp.Schemas.User
  alias YourApp.Schemas.{Item, Post}

  use Cantare.Abilities, repo: YourApp.Repo

  def abilities(User) do
    |> can(:show, Item, fn %User{} = user, %Item{} = item -> end)
    |> can(:edit, Post, fn %User{} = user, %Post{} = post ->, user.created_at) == :gt end)
    |> can(:create, League, fn current_user -> [name:] end)

Further README steps coming soon... This is still a very work-in-progress library that has _just_ been separated out of a private project from which it originated. There is still plenty of problems to resolve - perhaps most importantly, it still needs to be adapted to Ecto 3.

Stay tuned!

## Installation

If [available in Hex](, the package can be installed
by adding `cantare` to your list of dependencies in `mix.exs`:

def deps do
    {:cantare, "~> 0.1.0"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](