Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [v0.4.1] - 2026-05-20

### Fixed

- Reverted `:igniter` dependency from `only: [:dev, :test], runtime: false` back to `optional: true`, restoring correct Igniter behaviour for `mix permit.install` / `mix igniter.install permit`.

## [v0.4.0] - 2026-04-28

### Added
Expand All @@ -22,7 +28,7 @@ All notable changes to this project will be documented in this file.
### Fixed

- [Breaking] The behaviour of predicate functions has been changed to match the behaviour of Permit.Ecto in has-many associations (#53).

With two disjunctive conditions on the same has-many association, the predicate function will now return `true` if at least one of the conditions is met - matching the behaviour of Permit.Ecto which builds a JOIN query and naturally returns the base record if _any_ associated record matches the query condition.

Example:
Expand All @@ -37,19 +43,19 @@ All notable changes to this project will be documented in this file.
|> can(:read, %Article{authorized_viewers: [%{id: user.id}]})
end
end

# Article has no authorized viewers
can(user) |> read?(%Article{authorized_viewers: []})
=> false

# All authorized viewer records match current user
can(user) |> read?(%Article{authorized_viewers: [%{id: user.id}]})
=> true

# Any authorized viewer record matches current user
can(user) |> read?(%Article{authorized_viewers: [%{id: user.id}, %{id: 123}]})
=> true

# No authorized viewer records match current user
can(user) |> read?(%Article{authorized_viewers: [%{id: 123}]})
=> false
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ mix permit.patch.controller MyAppWeb.ArticleController MyApp.Blog.Article
mix permit.patch.live_view MyAppWeb.ArticleLive.Index MyApp.Blog.Article
```

See the [Igniter documentation](https://hexdocs.pm/igniter) for more details.
The `:igniter` dependency is required to run these tasks from within the project. See the [Igniter documentation](https://hexdocs.pm/igniter) for more details.

### Manual installation

Expand All @@ -299,7 +299,7 @@ Alternatively, add `permit` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:permit, "~> 0.3.3"}
{:permit, "~> 0.4.0"}
]
end
```
Expand All @@ -309,10 +309,11 @@ For additional integrations, add the relevant packages:
```elixir
def deps do
[
{:permit, "~> 0.3.3"},
{:permit_ecto, "~> 0.2.4"}, # For Ecto integration
{:permit_phoenix, "~> 0.3.0"}, # For Phoenix & LiveView
{:permit_absinthe, "~> 0.1.0"} # For GraphQL (Absinthe)
{:permit, "~> 0.4.0"},
{:permit_ecto, "~> 0.3.0"}, # For Ecto integration
{:permit_phoenix, "~> 0.5.0"}, # For Phoenix & LiveView
{:permit_absinthe, "~> 0.3.0"}, # For GraphQL (Absinthe)
{:igniter, "~> 0.8", only: [:dev, :test]} # For generator tasks
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/permit.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if Version.match?(System.version(), ">= 1.15.0") and Code.ensure_loaded?(Igniter
@shortdoc "Installs Permit authorization into your project"

@moduledoc """
Installs Permit authorization into your project.
Installs Permit authorization into your project. Requires the `:igniter` dependency.

## Usage

Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Permit.MixProject do
use Mix.Project

@version "0.4.0"
@version "0.4.1"
@source_url "https://github.com/curiosum-dev/permit/"

def project do
Expand Down Expand Up @@ -68,7 +68,7 @@ defmodule Permit.MixProject do

defp igniter_dep do
if Version.match?(System.version(), ">= 1.15.0") do
[{:igniter, "~> 0.5", only: [:dev, :test], runtime: false}]
[{:igniter, "~> 0.5", optional: true}]
else
[]
end
Expand Down
Loading