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
    Concepts

    Activities

    Global action names and the activity hierarchy.

    An activity is an abstract action, one of the two global vocabularies of the model. Activities are not org-scoped: every organization shares the same set of action names, which keeps rules comparable across the whole tree.

    pgmorbac seeds the CRUD four; add your own domain verbs:

    INSERT INTO morbac.activities (name, description) VALUES
        ('prescribe', 'Issue a prescription'),
        ('dispense',  'Hand out medication')
    ON CONFLICT (name) DO NOTHING;

    Activity hierarchy

    morbac.activity_hierarchy lets a senior activity imply junior ones:

    INSERT INTO morbac.activity_hierarchy (senior_activity, junior_activity)
    VALUES ('update', 'read');

    With that row, a rule granting update also satisfies checks for read: is_allowed(..., 'read', v) matches rules whose activity is read or any senior activity that implies it.

    Activity-view bindings

    By default any activity can be paired with any view in a rule. If you want a whitelist, populate morbac.activity_view_bindings; once at least one binding exists for a view, a trigger rejects rules that pair it with an undeclared activity:

    INSERT INTO morbac.activity_view_bindings (activity, view) VALUES
        ('prescribe', 'prescriptions'),
        ('read',      'prescriptions');
    -- now: a rule (dispense, prescriptions) is rejected until declared

    Use bindings to catch typos and nonsense pairs (dispense on invoices) at write time instead of silently never matching.

    Naming guidance

    Prefer the CRUD verbs where the action maps to one; reserve custom verbs for real domain actions (prescribe, dispense, valider).

    PreviousRolesNext Views
    pgmorbac - Multi-OrBAC permission engine for PostgreSQL
    DocumentationDownloadGitea