View Source API Reference permit v0.1.0

Modules

Permit is an extensible, DSL-less library allowing the coder to define authorization rules in plain Elixir.

Overview

The Permit.Actions behaviour defines an exhaustive set of actions that can be performed on resources in the business domain.

Extends the predefined Permit.Actions module and defines the following action mapping

Encapsulates the directed acyclic graph built from permissions defined using Permit.Permissions and provides traversal functions.

Raised when action groupings defined in a Permit.Actions implementation result in a circular dependency.

Represents the list of operators for usage in defining permission conditions, for example Permit.Operators.Eq defines the equality operator usable as :== or alternatively :eq, with given semantics.

Equality operator, accessible via :== and :eq.

Greater-than-or-equal operator, accessible via :>= and :ge.

Generic operator behaviour. For each operator, it allows defining

Greater-than operator, accessible via :> and :gt.

ILIKE operator, accessible via :ilike. Semantically equivalent to matching a regular expression built from a SQL-like syntax (e.g. "FOO%BAR" pattern is equivalent to ~r/FOO.*BAR/). Case insensitive.

List inclusion operator, accessible via :in. Implemented using Kernel.in/2.

Nil equality operator operator, accessible via :is_nil or :nil?.

Less-than-or-equal operator, accessible via :le, :<=.

LIKE operator, accessible via :like. Semantically equivalent to matching a regular expression built from a SQL-like syntax (e.g. "FOO%BAR" pattern is equivalent to ~r/FOO.*BAR/). Case sensitive.

Less-than operator, accessible via :< and :lt.

Regular expression matching operator, accessible via :=~ and :match.

Not-equal operator, accessible via :!= and :neq.

Defines the application's permission set.

Describes conditions written as logical formula in disjunctive normal form.

Represents the product of parsing a condition by a function implementing the Permit.Permissions.can/1 callback.

Encapsulates the list of conditions having been parsed by an implementation of Permit.Permissions.

Basic implementation of Permit.ResolverBase behaviour. Resolves and checks authorization of records or lists of records based on provided loader functions and parameters.

Provides a basis for building resolver modules. A resolver is conceptually a module containing functions answering the following questions

Allows mapping subject structure into one or more distinct subject records to denote that any of these must be authorized to perform an action.

Includes type definitions used across the codebase of Permit, as well as its extensions.

Contains types of conditions that can be defined in the application's permission definition module (Permit.Permissions or e.g. for Ecto Permit.Ecto.Permissions).

Raised when a given action is not implemented in the actions module (implementing Permit.Actions).