Represents the product of parsing a condition by a function implementing
the Permit.Permissions.can/1 callback.
Replaces Permit.Permissions.ParsedCondition in applications using Permit.Ecto.
Refer to Permit.Permissions.ParsedCondition documentation for more details.
In add_conditionition to the original implementation, its metadata also includes
dynamic query constructors, derived from Permit.Operators.DynamicQuery.
A condition parsed by Permit's rule syntax parser contains:
- condition semantics, that is: a function that allows for checking whether the condition is satisfied
- an indication of whether it is negated (i.e. a condition defined as
{:not, ...}) - metadata (
:private), which can be used by alternative parsers (e.g.Permit.Ecto.Permissionsputs dynamic query constructors there)
Part of the private API, subject to changes and not to be used on the application level.
Summary
Types
@type dynamic_query() :: (struct(), struct() -> Ecto.Query.t())
Functions
@spec to_dynamic_query( Permit.Permissions.ParsedCondition.t(), Permit.Types.object_or_resource_module(), Permit.Types.subject(), Ecto.Query.t() ) :: {:ok, Ecto.Query.dynamic_expr()} | {:error, term()}