View Source Permit.Permissions.ParsedCondition (permit v0.2.1)
Represents the product of parsing a condition by a function implementing
the Permit.Permissions.can/1
callback.
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.
Summary
Types
@type condition_type() :: :const | :function_1 | :function_2 | {:operator, module()}
@type t() :: %Permit.Permissions.ParsedCondition{ condition: Permit.Types.ConditionTypes.boolean_condition() | {Permit.Types.struct_field(), (Permit.Types.subject(), Permit.Types.object() -> any())} | Permit.Types.ConditionTypes.fn1_condition() | Permit.Types.ConditionTypes.fn2_condition(), condition_type: condition_type(), not: boolean(), private: map(), semantics: (Permit.Types.struct_field(), Permit.Types.subject(), Permit.Types.object() -> boolean()) }