Roles & Permissions (RBAC)

Built-in Roles

RolePermissions
readonlySELECT on all collections
readwriteSELECT, INSERT, UPDATE, DELETE
adminAll operations + DDL
tenant_adminAdmin within a tenant
superuserUnrestricted (cross-tenant)
cluster_adminCluster-wide admin operations without full superuser capabilities

Higher roles inherit all permissions of lower roles.

Database-Scoped Roles

NodeDB supports roles scoped to specific databases:

GRANT DATABASE_OWNER ON DATABASE analytics TO alice;
GRANT DATABASE_EDITOR ON DATABASE analytics TO bob;
GRANT DATABASE_READER ON DATABASE analytics TO charlie;

ALTER USER alice SET DEFAULT DATABASE analytics;
RolePermissionsScope
DATABASE_OWNER(db)All operations within database, including schema and user managementSpecific database
DATABASE_EDITOR(db)SELECT, INSERT, UPDATE, DELETE on collectionsSpecific database
DATABASE_READER(db)SELECT onlySpecific database

ClusterAdmin Role

The ClusterAdmin role enables privileged cluster operations without granting full superuser access. ClusterAdmins can perform cluster-wide administration tasks but cannot bypass row-level security or read data from databases they don't own.

GRANT ROLE cluster_admin TO alice;

-- ClusterAdmin can:
ALTER DATABASE ... RENAME TO;
ALTER DATABASE ... SET QUOTA;
ALTER DATABASE ... SET IDLE_TIMEOUT;
CREATE OIDC PROVIDER;
ALTER OIDC PROVIDER;

Admin DDL Gating Matrix

Certain administrative DDL operations are gated by required roles. Attempting an operation without the required role returns INSUFFICIENT_PRIVILEGE and emits a PermissionDenied audit entry.

DDL OperationRequired RoleNotes
CREATE DATABASESuperuser or ClusterAdminRequires cluster-wide privilege
DROP DATABASE (non-default)SuperuserPermanent deletion; limited to superuser
DROP DATABASE ... FORCESuperuserForce-drop with cascade safety override
ALTER DATABASE ... RENAMESuperuser or ClusterAdminCosmetic change; durable identity is DatabaseId
ALTER DATABASE ... SET QUOTASuperuser or ClusterAdminChanges resource limits
ALTER DATABASE ... SET IDLE_TIMEOUTSuperuser or ClusterAdminSession timeout configuration
ALTER DATABASE ... SET AUDIT_DMLSuperuser or ClusterAdminChanges audit behavior
ALTER DATABASE ... MATERIALIZESuperuser, ClusterAdmin, or DatabaseOwnerMaterializes a clone
ALTER DATABASE ... PROMOTESuperuser onlyOne-way mirror promotion; locked to superuser due to operational risk
CLONE DATABASESuperuserCross-database operation requiring cluster privilege
MIRROR DATABASESuperuserRead-only replica setup
MOVE TENANTSuperuserCross-database tenant relocation
BACKUP DATABASESuperuser or DatabaseOwnerExport entire database
RESTORE DATABASESuperuserDisaster recovery operation
KILL SESSIONSuperuser, ClusterAdmin, or session-ownerTerminate a session
CREATE/ALTER/DROP OIDC PROVIDERSuperuser or ClusterAdminSSO configuration

Custom Roles

CREATE ROLE analyst;
CREATE ROLE data_engineer;

Granting Permissions

GRANT SELECT ON orders TO analyst;
GRANT INSERT, UPDATE ON orders TO data_engineer;
GRANT ALL ON orders TO admin;
GRANT EXECUTE ON FUNCTION full_name TO analyst;
GRANT BACKUP ON TENANT acme TO ops_user;

Revoking

REVOKE INSERT ON orders FROM analyst;

SECURITY DEFINER

Functions and triggers can execute with owner's permissions:

CREATE FUNCTION admin_count() RETURNS INT SECURITY DEFINER
AS BEGIN RETURN (SELECT COUNT(*) FROM audit_log); END;

Introspection

SHOW GRANTS FOR analyst;
SHOW PERMISSIONS;

See (databases) for database creation, quota, and management. See (quotas) for resource limits. See (audit-logging) for permission denial auditing. See (oidc-sso) for OIDC provider setup and claim mapping.