Caravela.Policy.Entry (Caravela v0.13.2)

Copy Markdown View Source

The compiled IR for a single policy :entity do ... end block.

The anonymous functions themselves live as clauses of __caravela_policy_scope__/3, __caravela_policy_field_visible__/4 and __caravela_policy_allow__/4 on the domain module. This struct is metadata so generators and the runtime helpers can reason about which rules exist per entity.

Summary

Functions

Does this entry have an action gate for action?

Does this entry have a field rule for field?

Types

t()

@type t() :: %Caravela.Policy.Entry{
  actions: [Caravela.Policy.ActionGate.t()],
  entity: atom(),
  fields: [Caravela.Policy.FieldRule.t()],
  has_scope?: boolean()
}

Functions

action_gate(entry, action)

Does this entry have an action gate for action?

field_rule(entry, field)

@spec field_rule(t(), atom()) :: Caravela.Policy.FieldRule.t() | nil

Does this entry have a field rule for field?