Relationship-based access control (ReBAC)

Decide who may see which rows by how they connect in the graph—not only by job title or a single “can read everything” flag. AnythingGraph encodes those rules in playbooks and enforces them when people and AI query your data.

What is ReBAC?

ReBAC stands for relationship-based access control. Instead of asking only “Does this user have the HR role?”, you ask “Is this user related to this row in a way the business allows?”—for example, manages that department, owns that account, or is the attending clinician for that patient.

Permissions follow paths in your data: employee → department → manager, opportunity → account → sales rep, clinical note → patient → care team. If the path from a row to the requesting person matches a rule, the row is visible; otherwise it stays hidden.

Traditional role check: “User has role Sales” → see all sales tables? ReBAC: “User owns Account Northwind” → see Northwind’s contacts and deals only.

Why relationships, not only roles?

Role-based (RBAC)

Good for coarse gates (“finance team”, “admin”). Weak when two people share a role but should see different customers, departments, or patients.

Relationship-based (ReBAC)

Matches how organizations actually work: territory, reporting line, clinic panel, account ownership. Same role, different slice of data—ideal for governed dashboards and AI assistants.

How AnythingGraph supports ReBAC

ReBAC is declared in an ontology playbook (one JSON pack), enforced at query time on a data capsule (a synced graph snapshot per playbook), and applied whenever a caller supplies a subject—the person or agent identity asking the question.

  1. 1
    Define rules in the playbook Under relationship_access_rules, you describe who the subject is (e.g. an HR user or care provider), default deny, and allow rules using graph paths, field matches, or “only if you already see the linked record.”
  2. 2
    Install data and sync the capsule Install the playbook in the dashboard so rows and links live in the graph. Sync Settings → Data Capsules so rdf-cache holds the RDF for that playbook.
  3. 3
    Query with a subject identity Dashboard users, APIs, and MCP tools pass subject_id (e.g. alice.mgr, dr.chen). The engine walks instance relationships and filters results to allowed rows only.
  4. 4
    AI agents inherit the same boundaries MCP reads governed capsules only—run_sparql, ask_graph, and list_allowed_rows all respect the same rules, so agents do not bypass policy with a broader prompt.
Deny by default: Governed playbooks typically hide every row unless an allow rule matches. Unknown subjects see nothing—not the full dataset.

Rule types (in plain language)

Playbook authors combine a few patterns. You do not need to implement these in application code—they live in JSON.

Graph path

Walk links from the row to the subject (e.g. employee → department → manager).

Engineering manager sees employees in departments they manage.

Field match

Compare a field on the row to the subject without a hop (e.g. same email).

Employee sees their own profile when emails match.

Prior access

Allow a sensitive row only if the subject may already see a linked record.

Compensation or clinical notes only when the linked person is already on the user’s panel.

Role filter on subject

Limit which subjects a rule applies to (e.g. only HR Business Partner, not every manager).

Nurses see patients in clinic; note access limited to physicians and coordinators.

Community playbook examples with ReBAC

Install from Playbooks, sync the data capsule, then try Graph View or MCP with different subject_id values to see different slices.

HR relationship access

Managers see their department; HR partners see supported departments; compensation only when the employee is already visible—Alice sees Engineering, not Sales.

CRM relationship access

Reps see owned accounts; territory managers see their region; opportunities only with prior access to the account—pipeline data stays in the right hands.

Medical care access

Clinicians see patients in their clinic panel; clinical notes gated by role—coordinators and attendings see notes, nurses may see patients without every note.

For builders and operators

Author or extend rules in the playbook JSON. After changes, restart rdf-cache so rule files reload. For step-by-step authoring (paths, direction, examples), use the Playbook Cookbook.

Operational setup—install, data capsules, MCP—is in Documentation.

Tip for AI queries: When ReBAC is on, analytics and MCP queries should include row identifiers in the result (e.g. ?row in SPARQL) so filtering can apply correctly.