View Source Permit.Ecto.Permissions.ParsedCondition (permit_ecto v0.1.0)
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 addition 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.Permissions
puts dynamic query constructors there)
Part of the private API, subject to changes and not to be used on the application level.
Link to this section Summary
Link to this section Types
@type dynamic_query() :: (struct(), struct() -> Ecto.Query.t())
Link to this section Functions
@spec to_dynamic_query( Permit.Permissions.ParsedCondition.t(), Permit.Types.object_or_resource_module(), Permit.Types.subject() ) :: {:ok, Ecto.Query.dynamic()} | {:error, term()}