diff --git a/CHANGELOG.md b/CHANGELOG.md index 973f4ba..e0da76f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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: @@ -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 diff --git a/README.md b/README.md index e062d3b..823c0a6 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ``` @@ -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 ``` diff --git a/lib/mix/tasks/permit.install.ex b/lib/mix/tasks/permit.install.ex index 3a7e223..53d42a0 100644 --- a/lib/mix/tasks/permit.install.ex +++ b/lib/mix/tasks/permit.install.ex @@ -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 diff --git a/mix.exs b/mix.exs index 20ae981..5eeb70f 100644 --- a/mix.exs +++ b/mix.exs @@ -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 @@ -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