pgmorbacMulti-OrBAC for PostgreSQL
    DocumentationDownloadSource
    Use cases
    • How do I...?
    Getting Started
    • Introduction
    • Quick start
    • How pgmorbac compares
    • Upgrade
    Concepts
    • Organizations
    • Roles
    • Activities
    • Views
    • Contexts
    • Rules & Modalities
    • Global Rules
    • System Principals
    • Constraints
    • Row-Level Security
    • Decision Cache
    Resolution
    • is_allowed
    Recipes
    • Org Hierarchies
    • Multi-Tenant Isolation
    • Wildcard Admin
    • Delegation
    • Service Accounts
    • Deny Rules
    • Separation of Duty
    • Derived Roles
    • Cross-Org Access
    • Obligations & Recommendations
    • Temporal Access
    Integration
    • Fastify
    • PostgREST & RLS Context
    • SQL Only
    Reference
    • Function Reference
    Getting Started

    How pgmorbac compares

    RBAC, OrBAC, Multi-OrBAC, ABAC, PBAC, ReBAC: what each decides on and where this fits.

    Access control models are often presented as competitors. They are better read as a progression: each one adds a dimension the previous could not express.

    At a glance

    ModelDecides onAnswersStrengthCost
    ACLidentity per object"is this user on the list?"trivial to understandunmanageable at scale, no structure
    RBACrole"does this role have this permission?"matches job titles, easy to auditone flat namespace, no where
    OrBACorganization + role + activity + view + context"in this organization, may this role do this here and now?"abstraction and context, policy separated from implementationmore concepts to learn
    Multi-OrBACthe above, across an organization tree"and what about subsidiaries, delegation and cross-org access?"native multi-tenancy and hierarchyneeds a real engine
    ABACarbitrary attributes"do the attributes satisfy the policy?"maximum expressivenesshard to audit, hard to answer "who can do X?"
    PBACcentrally authored policies"what does the policy engine say?"governance and central controlusually a separate service to run
    ReBACrelationships in a graph"is there a path from user to object?"natural for sharing and ownership graphsgraph queries, harder to reason about statically

    Capability by capability

    No model wins every row. Each was designed around a different question, so the honest comparison is about fit: what is native, what is reachable with extra work, and what a model was simply never meant to do.

    CapabilityRBACOrBACABACPBACReBACMulti-OrBAC
    Roles as the primary grant
    yesyespartialpartialpartialyes
    Organization as a first-class dimension
    rules attached to an org, not just a role
    noyespartialpartialpartialyes
    Organization hierarchy / subtree scope
    one rule covering a whole branch of the tree
    nopartialnopartialpartialyes
    Decisions from arbitrary attributes
    time of day, request risk, resource labels
    nopartialyesyesnopartial
    Relationship / graph reasoning
    "shared with people you follow"
    nonopartialpartialyespartial
    Explicit deny that overrides allow
    noyesyesyespartialyes
    Separation of duty & role limits
    yesyespartialpartialnoyes
    Time-bounded grants & delegation
    nopartialpartialpartialpartialyes
    Central, auditable policy
    answer "who can do X?" statically
    yesyesnoyespartialyes
    Runs without a separate service
    partialpartialnononoyes
    native possible with extra machinery not the model's job

    pgmorbac is strong where the decision is organizational and belongs in the database. It is not the sharpest tool for attribute-driven decisions (an ABAC engine is) or for deep relationship graphs (ReBAC is), and it can reach into both only with extra machinery. Pick the row that matters most to you.

    Where pgmorbac sits

    pgmorbac implements Multi-OrBAC, and deliberately borrows from its neighbours:

    • From RBAC: roles, role hierarchy, separation of duty and cardinality constraints. Anyone who knows RBAC is already productive.
    • From OrBAC: the organization as a first-class dimension, abstract activities and views, contexts, and four deontic modalities (permission, prohibition, obligation, recommendation).
    • From ABAC: context evaluators are arbitrary SQL predicates, so attributes of the user, the time or the environment can gate a rule.
    • From ReBAC: derived roles compute membership from your own relational data, so "head of this department" is a query, not an assignment.
    • From PBAC: policy lives in one place with a single decision function, except that place is your database rather than a separate service.

    Concretely: the same requirement in each model

    "Nurses may read patient records at Clinique Valmont Nord and its departments, but never at Clinique Valmont Sud."

    ModelWhat you write
    RBACa distinct role per site (nurse-north, nurse-south), duplicated for every new site
    OrBACa rule per site: role nurse may read patients at that org, repeated for each hospital and department
    ABACa policy comparing a site attribute on the user with one on the record, plus attribute plumbing everywhere
    PBACa central policy document enumerating site membership, evaluated by a separate decision service
    ReBACa member-of edge per user and site, plus a traversal rule
    Multi-OrBACone rule: role nurse, activity read, view patients, org Clinique Valmont Nord, scope subtree

    The Multi-OrBAC version covers departments created next year with no further writes, and the isolation from Sud needs no rule at all: the absence of a grant is the isolation.

    When pgmorbac is not the right tool

    Be honest about the fit:

    • Single-tenant with three roles and no hierarchy. Plain RBAC in your application is simpler and enough.
    • Decisions driven mostly by request attributes (IP ranges, device posture, risk score) rather than organizational structure. A dedicated ABAC or PBAC engine fits better; you can still keep pgmorbac for the organizational half.
    • Deeply relational sharing ("users can see documents shared with people they follow"). That is ReBAC's home ground.
    • Data lives outside PostgreSQL. pgmorbac decides inside the database; if the database is not in the request path, its main advantage disappears.

    Why in the database at all

    Most engines answer in the application layer, which leaves every query one forgotten check away from a leak. pgmorbac's decisions are reachable from SQL, so row-level security policies enforce them per row for every client that connects, including psql and analytics tools. That is the argument in one line: the last line of defence should be the layer nothing bypasses.

    PreviousQuick startNext Upgrade
    pgmorbac - Multi-OrBAC permission engine for PostgreSQL
    DocumentationDownloadGitea