Permit

Permission-based, Ecto-powered authorization library for access control in Phoenix and LiveView applications

Meet Permit

Permit is an Elixir library that makes dealing with resource authorization and access control easier, providing a single source of truth about permissions in the application's business domain.

It helps maintain consistency and avoid repetition of authorization-related concerns, slotting in seamlessly into the Phoenix Controller pipelines and LiveView lifecycles.
Permit basic usage example
Industry
Development Tools
Permission Management & Authorization
Type of project
Open-source Elixir Library
Elixir logo
Elixir
Phoenix logo
Phoenix
Phoenix LiveView logo
Phoenix LiveView
Postgres logo
Postgres

Permit description

Permit helps unify permission management concerns across the codebase, providing a resource- and attribute-based, plain-Elixir rule definition syntax, as well as mechanisms for constructing Ecto queries for accessible resources based on defined permissions and consistently use it for preloading and authorizing resources in Phoenix controllers and LiveView.

Permit basic usage example

When plugged into Phoenix, it automatically preloads records based on current context (e.g. path and params) taken from a controller's Conn or, in LiveView, from the Socket and event parameters. It then either puts the found record in assigns if authorized, or handles authorization failure otherwise.

Permit usage example with Phoenix Controller

Permit can work with or without Ecto, as well as with or without Phoenix, and is extensible for usage with any other Elixir-based toolset through its Resolver behaviour. We encourage you to try it out in your applications or contribute to its development!

Permit usage example with Phoenix LiveView