RBAC
SECTION 4 — USER ROLES & RBAC SYSTEM
4.1 Architecture: Multi-Tenant Hierarchically Delegated RBAC
Notesglider implements a classic multi-tenant, hierarchically delegated RBAC architecture — the same pattern used by production SaaS platforms such as Google Workspace, Salesforce, and Notion. Every role can only see and act downward within its own scope. No lateral or upward access is possible at any level. This enforces the principle of least privilege across the entire platform.The 5-Layer Role Hierarchy
4.2 Login Role Types
There are exactly four login role types in the system. No other roles exist beyond these:Metadata Clarification: The Newsletter JSON schema containsaccess-rolesvalues such asreviewer,publisher, andadmin. These are document-level metadata labels only — not separate login identities. When the Editor reviews a document, thereviewed-byfield is populated with the Editor’s identity. When approved,approved-byis populated with the Editor’s identity. Thepublisherandadminmetadata labels always resolve to the Editor role at runtime.
4.3 The Organisation — Tenant Container (Not a Role)
An Organisation is not a user role — it is the tenant isolation boundary of the system. Think of it as Google Workspace treats a domain, or how Slack treats a workspace.- Each Organisation is created by a Teacher during self-registration.
- An Organisation begins with
status: pending_approvaland has zero operational access until the Super Admin explicitly authorises it. - Once authorised by the Super Admin, the Organisation is mapped to a specific Editor.
- An Organisation is fully isolated: no cross-org reads, writes, or role assignments are possible under any circumstance.
- Role assignments are always org-scoped — a Teacher in Org-1 has zero visibility into Org-2, even if the same person were to hold accounts in both.
4.4 Role 1: Super Admin — Capabilities
The Super Admin is the root authority of the entire system. This role operates entirely outside any tenant scope — it has no Organisation assignment and its data scope istenant_id = NULL (system-level).
The Super Admin is a single designated account — the platform software owner. There is no UI for teachers or editors to create or discover Super Admin accounts. Super Admin credentials are provisioned at system setup time by the developer/platform owner.
Data scope: Queries span all tenants —
WHERE tenant_id IS NULL or unrestricted. Super Admin sees everything.
4.5 Role 2: Editor — Capabilities
An Editor is a Tenant Manager — they own and oversee one or more Organisations that have been mapped to them by the Super Admin. This is delegated administration: the Super Admin offloads day-to-day tenant governance to the Editor. Key constraint: An Editor’s visibility is strictly bounded to their mapped Organisations. They cannot access Organisations assigned to other Editors. They cannot spawn other Editors (only the Super Admin can do this).
Scoping rule: Every Editor database query is predicated on
WHERE org_id IN (SELECT id FROM organisations WHERE editor_id = current_editor_id) to prevent cross-tenant privilege bleed.
4.6 Role 3: Teacher — Capabilities
A Teacher is the Org-level Admin — they function as the workspace owner within the strict boundaries of their single Organisation.
Key constraint: A Teacher’s administrative visibility is strictly bounded to their own Organisation. They cannot see other Teachers, other Orgs, or any Editor/Super Admin data.
4.7 Role 4: Sub-member — Capabilities
Sub-members are the leaf nodes of the hierarchy — enrolled by Teachers. They represent the primary end-users of the application’s core document features.- Sub-members belong to a Teacher’s Organisation — not the Editor’s scope directly.
- Each sub-member has their own independent app login with role =
sub-member. - Sub-member access is scoped exclusively to the parent Teacher’s document pool — no cross-Organisation visibility.
- The parent Teacher has a per-sub-member permission configuration panel within Team Settings.
- Configurable permissions per sub-member (independently toggleable per person):
- Document creation rights
- Document editing rights
- Document submission-to-Editor rights
- Export rights
- All permissions are enforced server-side on every relevant API endpoint — client-side hiding is a UX convenience only and never a security substitute.
- Sub-members cannot:
- Manage or enroll other sub-members
- Access billing or settings outside their own account preferences
- See documents outside the parent Teacher’s pool
- Change their own permission level
- Perform any administrative action within the Organisation
status: pending until the Teacher explicitly authorises it.
4.8 Sub-member Activity Logging
- The Teacher has a dedicated Team Activity Log view in their dashboard.
- Every sub-member action is recorded with: action type, document affected, timestamp, sub-member identity.
- This log is read-only for the Teacher — they cannot edit or delete log entries.
- The Editor (and Super Admin) also have scope-inherited visibility into sub-member activity through their respective dashboard views.
4.9 Complete Permission Matrix
4.10 Core RBAC Architectural Principles (Non-Negotiable)
These are the immutable pillars governing the entire system:4.11 Document Pool Visibility & Permissions
All documents within an Organisation belong to a shared document pool that is visible — with varying levels of access — to every authorised member of that Org. The principle is: the pool is collectively visible, but CRUD permissions depend on who created the document and your role.4.11.1 Visibility Rules by Creator
4.11.2 Attribution & Badges
- Every document card/row displays the creator’s name and role:
Created by: [Name] ([Role]). - Editor-created documents carry a distinct “Created by: Editor” badge visible to Teacher and Sub-members. This ensures transparency — Teacher always knows which documents were created on their behalf.
- Sub-member-created documents show
Created by: [Sub-member Name]visible to Teacher and Editor. - The
created_by_idandcreated_by_rolefields in thedocumentstable enforce this attribution at the data layer (see Section 29 #documents).
4.11.3 Document Comments (Dispute Resolution)
Every document in the pool supports a simple linear comment thread for communication and dispute resolution between roles.- Who can comment: Editor, Teacher, and Sub-member — any authorised member of the Org can add a comment to any document visible to them.
- Thread structure: Chronological (newest at bottom), flat (no nesting/replies-to). Each comment records: author name, role badge, timestamp, and message body.
- Use cases: Flagging errors, requesting revisions, clarifying content, recording editorial decisions, resolving disputes about document content.
- Visibility: All comments on a document are visible to all roles that can view that document. Comments are append-only for non-admin roles — once posted, a comment cannot be edited or deleted by the author. Only Super Admin can delete comments (via audit action).
- Schema: See
document_commentstable in Section 29.
4.11.4 Audit Logging
All document pool actions — create, edit, delete, status change, comment addition — are recorded inaudit_logs with the acting user’s ID, role, timestamp, and action type. This provides a complete chain-of-custody for every document change.