Mediate.Answer (mediate v0.1.0)

Copy Markdown View Source

What a decider answers for one subject, operation, and object. It holds the verdict, the reason in one word, the version of the rules that gave it, and meta.

meta belongs to the decider. What only one decider can say travels there, so the reason stays a word every decider shares. A decider that sets one of these keys gives it this value:

KeyValue
:ruleThe rule, clause, policy, or relation the verdict came from
:matchedThe rules, clauses, or path an explanation lists
:detailThe engine's own text, where the reason is :engine_unreachable
:kindThe subject kind the port does not know

Summary

Types

Why the verdict is what it is, in a form a record carries without an attribute value.

t()

One answer: the verdict, why, the policy version that decided, and whatever the adapter puts in meta.

What the rule said about the request.

Functions

The reasons, in the order the type lists them.

Types

reason()

@type reason() ::
  :allowed
  | :deny_by_default
  | :rule_denied
  | :engine_unreachable
  | :missing_fact
  | :unknown_operation
  | :unknown_subject_kind

Why the verdict is what it is, in a form a record carries without an attribute value.

t()

@type t() :: %Mediate.Answer{
  meta: map(),
  reason: reason(),
  verdict: verdict(),
  version: String.t() | nil
}

One answer: the verdict, why, the policy version that decided, and whatever the adapter puts in meta.

verdict()

@type verdict() :: :allow | :deny

What the rule said about the request.

Functions

reasons()

@spec reasons() :: [reason()]

The reasons, in the order the type lists them.