Guard

works.iterative.workflow.Guard
See theGuard companion trait
object Guard

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Guard.type

Members list

Type members

Classlikes

final case class And[R, S](left: Guard[R, S], right: Guard[R, S]) extends Guard[R, S]

Conjunction guard — both branches must pass.

Conjunction guard — both branches must pass.

Failures are accumulated flatly: any inner Conjunction is flattened into the list, so Conjunction(Conjunction(A, B), C) evaluates to Conjunction(List(A, B, C)). This guarantees no redundant nesting of Conjunction nodes.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all
final case class Invalid[R, S](label: String, message: UserMessage) extends Guard[R, S]

Always-failing data guard leaf — for guard branches whose failure condition is a property of the command payload, not the entity, so no genuine Predicate[S] test applies (e.g. a payload-dependent requiresPayload branch). Mirrors Requirement's describe/check shape without a predicate: check always returns Left(GuardFailure.Leaf(label, message)).

Always-failing data guard leaf — for guard branches whose failure condition is a property of the command payload, not the entity, so no genuine Predicate[S] test applies (e.g. a payload-dependent requiresPayload branch). Mirrors Requirement's describe/check shape without a predicate: check always returns Left(GuardFailure.Leaf(label, message)).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all
final case class Or[R, S](left: Guard[R, S], right: Guard[R, S]) extends Guard[R, S]

Disjunction guard — at least one branch must pass.

Disjunction guard — at least one branch must pass.

Node-level: if both branches fail, their failures are wrapped in GuardFailure.Disjunction with exactly two elements (no flattening of inner Disjunction nodes).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all
final case class RequireIdentity[R, S](label: String, holds: (GuardContext[R, S]) => Boolean) extends Guard[R, S]

Auth guard leaf — evaluates an arbitrary identity closure; failure → GuardFailure.Unauthorized.

Auth guard leaf — evaluates an arbitrary identity closure; failure → GuardFailure.Unauthorized.

The holds closure receives the full GuardContext, allowing it to bridge userId (the caller's identity) against entity-held handles (e.g. the assigned VedouciProjektu). The bridging logic lives inside the closure, not in the kernel.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all
final case class RequireRole[R, S](role: R) extends Guard[R, S]

Auth guard leaf — checks that the caller holds role; failure → GuardFailure.Unauthorized.

Auth guard leaf — checks that the caller holds role; failure → GuardFailure.Unauthorized.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all
final case class Requirement[R, S](predicate: Predicate[S], message: UserMessage) extends Guard[R, S]

Data guard leaf — evaluates predicate against the entity; failure → GuardFailure.Leaf.

Data guard leaf — evaluates predicate against the entity; failure → GuardFailure.Leaf.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Guard[R, S]
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def always[R, S]: Guard[R, S]

A guard that always passes — default for transitions with no applicable condition.

A guard that always passes — default for transitions with no applicable condition.

Attributes

def invalid[R, S](label: String, message: UserMessage): Guard[R, S]

Convenience constructor for Invalid — an always-failing guard leaf.

Convenience constructor for Invalid — an always-failing guard leaf.

Attributes

def stripAuth[R, S](g: Guard[R, S]): Guard[R, S]

Rewrites RequireRole/RequireIdentity leaves to always, recursively through And/Or.

Rewrites RequireRole/RequireIdentity leaves to always, recursively through And/Or.

Used by WorkflowInterpreter.decide under AuthEnforcement.Skip — a tree-rewrite, not collapse-time failure-stripping, so Or(RequireRole, Requirement) under Skip PASSES even when the Requirement fails (only leaf-rewriting yields that).

Attributes