Skip to main content

Scope Levels

CORTEX RBAC uses three scope levels to control the reach of roles and permissions.

Overview

┌────────────────────────────────────────────────────────┐
│ PLATFORM Scope │
│ • System administrators │
│ • Cross-tenant operations │
│ • Platform-wide configuration │
│ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ TENANT Scope │ │
│ │ • Tenant administrators │ │
│ │ • All resources within a tenant │ │
│ │ • Tenant-wide policies │ │
│ │ │ │
│ │ ┌────────────────────────────────────────────┐ │ │
│ │ │ ORGANIZATION Scope │ │ │
│ │ │ • Department managers │ │ │
│ │ │ • Organization-specific resources │ │ │
│ │ │ • Team members │ │ │
│ │ └────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────┘

PLATFORM Scope

The highest privilege level, spanning all tenants.

Characteristics

PropertyValue
SpanAll tenants in the system
UsersSystem administrators only
Use CasesPlatform operations, tenant provisioning

Example Roles

RoleDescription
SUPER_ADMINFull platform access
PLATFORM_OPERATORInfrastructure operations
SUPPORT_ADMINCross-tenant support access

Platform-Level Operations

  • Create and manage tenants
  • View system-wide metrics
  • Manage platform configuration
  • Access any tenant for support
Security

Platform scope roles should be assigned to very few users. These roles have unrestricted access.

TENANT Scope

Access to all resources within a single tenant.

Characteristics

PropertyValue
SpanSingle tenant
UsersTenant administrators, managers
Use CasesTenant administration, cross-org operations

Example Roles

RoleDescription
TENANT_ADMINFull tenant access
TENANT_MANAGERLimited tenant management
HR_ADMINCross-org user management

Tenant-Level Operations

  • Create and manage organizations
  • Manage all users in the tenant
  • Configure tenant settings
  • View all tenant audit logs

Assignment (No Organization)

{
"userId": "user-id",
"roleId": "tenant-admin-id"
// No organizationId = tenant-wide
}

ORGANIZATION Scope

Access limited to a specific organization and its children.

Characteristics

PropertyValue
SpanSingle organization + descendants
UsersDepartment managers, team members
Use CasesTeam management, departmental access

Example Roles

RoleDescription
ORG_ADMINFull organization access
MANAGERTeam management
MEMBERStandard member access
VIEWERRead-only access

Organization-Level Operations

  • Manage organization users
  • Create sub-organizations
  • Assign organization-scoped roles
  • View organization audit logs

Assignment (With Organization)

{
"userId": "user-id",
"roleId": "org-admin-id",
"organizationId": "engineering-id"
}

Scope Inheritance

Child organizations inherit parent permissions:

User: Jane Doe
Role: ORG_ADMIN
Organization: Engineering

Can Access:
✓ Engineering (direct)
✓ Frontend Team (child)
✓ Backend Team (child)
✓ DevOps Team (child)
✗ Sales (different branch)

Choosing the Right Scope

Use PLATFORM When

  • Managing system infrastructure
  • Performing cross-tenant operations
  • Implementing support workflows

Use TENANT When

  • Administering a single customer
  • Implementing cross-department policies
  • Managing tenant-wide settings

Use ORGANIZATION When

  • Managing teams or departments
  • Implementing least-privilege access
  • Creating project-specific access

Scope Comparison

AspectPLATFORMTENANTORGANIZATION
Data AccessAll tenantsOne tenantOne org + children
User Count1-55-20Many
Use CaseSystem opsBusiness opsTeam ops
Risk LevelHighestHighNormal

Code Examples

Check User's Scope Level

interface User {
id: string;
roles: {
role: { scopeLevel: 'PLATFORM' | 'TENANT' | 'ORGANIZATION' };
organizationId: string | null;
}[];
}

function getHighestScope(user: User): string {
const scopePriority = ['PLATFORM', 'TENANT', 'ORGANIZATION'];

let highestScope = 'ORGANIZATION';
for (const assignment of user.roles) {
const scope = assignment.role.scopeLevel;
if (scopePriority.indexOf(scope) < scopePriority.indexOf(highestScope)) {
highestScope = scope;
}
}

return highestScope;
}

Filter by Scope

// Get roles at specific scope level
async function getRolesByScope(
accessToken: string,
scopeLevel: 'PLATFORM' | 'TENANT' | 'ORGANIZATION'
) {
const response = await fetch(
`http://localhost:8091/roles?scopeLevel=${scopeLevel}`,
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
return response.json();
}