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

    System Principals

    Trigger-locked service accounts that skip prohibitions.

    morbac.system_principals registers backend service accounts, such as Valmont's lab-importer job that files lab results at night. Registration has two effects:

    1. Prohibitions are skipped entirely for the principal in is_allowed. A misconfigured ban can never stop the nightly import. Permissions are still required: a principal with no permission rule gets denied like anyone else.
    2. Triggers freeze their configuration. No role assignments or revocations, no delegations involving them, no user rules, no targeted global prohibitions. Attempts raise an exception.
    INSERT INTO morbac.system_principals (user_id, description)
    VALUES ('aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa', 'Nightly lab importer');

    The table has no insert/update/delete policies: only the database owner, at deploy time, can register or remove principals. That is the point: system principals are infrastructure, not data that admins edit at runtime.

    See the service accounts recipe for the full pattern, including why ordinary service users usually should not be principals. The permission side of these accounts is written with global rules.

    PreviousGlobal RulesNext Constraints
    pgmorbac - Multi-OrBAC permission engine for PostgreSQL
    DocumentationDownloadGitea