Skip to content

VisibilityCondition

reference
1 min readUpdated

Kind: Interface

Source: atloria-monorepo/apps/api/src/reader-access/visibility.util.ts

D4 content segmentation — the ONE pure visibility evaluator.

A visibility rule is a JSON tree of attribute conditions over the reader's canonical claims (ReaderClaims.attrs: role / plan / region / custom):

{ "allOf": [ , ... ] } — every child must pass { "anyOf": [ , ... ] } — at least one child must pass { "attr": "plan", "op": "eq", "value": "pro" } — claim equals value { "attr": "role", "op": "in", "value": ["admin","ops"] } — claim ∈ values { "attr": "plan", "op": "neq", "value": "free" }— claim present and ≠ value

Semantics (fail-closed by design):

  • null / undefined rule → visible (public — no restriction)
  • missing claim → the condition FAILS (incl. neq)
  • claim values may be arrays → eq/in match on intersection
  • allOf: [] → true (vacuous)
  • anyOf: [] → false (nothing can satisfy it)
  • malformed rule node → false (a broken rule must never expose content)

Category rules CASCADE: a document's effective rule is its own rule ANDed with every rule up its category ancestor chain (see composeRules).

Properties

PropertyType
attrstring
op`'eq'
value`string

Was this page helpful?

Download as PDF