RBAC Concepts — Permissions, Roles, Scopes & Role Types
1. Overview
OpenELIS Global 2 is an open-source Laboratory Information System (LIS) built on Spring Boot (Java), React, and Docker, stewarded by DIGI at the University of Washington. Its RBAC (Role-Based Access Control) system is the security backbone that governs every user interaction — from patient registration to result validation.
Access control in OpenELIS Global 2 is layered across three components:
Keycloak — the external Identity and Access Management (IAM) provider that manages users, realms, and role tokens (JWTs)
Spring Security — the backend enforcement layer that validates JWT roles on every API request
React Frontend — the UI layer that renders menus and actions conditionally based on roles stored in the auth context
OpenELIS adheres to the strictest of security standards to keep data safe, supporting role-based access control, audit logging, and encrypted data at rest and in transit. — OpenELIS Global website
2. Permissions
Permissions are the atomic units of access control in OpenELIS Global 2. They represent the most granular level of what a user is allowed to do on a given resource. Permissions are not assigned directly to users — they are bundled into roles and enforced by modules.
2.1 Permission Structure
Each permission in OpenELIS is modelled as an action–resource pair, tied to a system module:
Component | Description | Example |
|---|---|---|
Action | The operation being performed | READ, WRITE, VALIDATE, PRINT, EXECUTE, DELETE |
Resource | The entity the action applies to | Result, Sample, Patient, Order, Report |
Module | The functional area that owns the permission | Results Entry, Sample Tracking, Patient Management |
Role Binding | Links a role to a module–action pair | Results entry role → AnalyzerResults module |
2.2 Permission Types
Permission Type | Description | Typical Holders |
|---|---|---|
READ | View records, dashboards, or reports | All authenticated roles |
WRITE | Create new records — samples, results, patients | Lab Technicians, Receptionists |
UPDATE / EDIT | Modify existing records | Technicians, Supervisors, Admins |
DELETE | Remove records (usually soft-delete) | Lab Supervisors, Global Admins only |
VALIDATE | Approve or reject test results for release | Results Validators, Lab Supervisors |
Print barcodes, labels, result reports | Technicians, Validators, Clinicians | |
EXECUTE | Trigger batch processes or report generation | Supervisors, Report Viewers, Admins |
CONFIGURE | Change system or lab settings | System/Global Administrators |
2.3 How Permissions Are Defined in the Codebase
In the legacy plugin model (openelisglobal-core / plugin architecture), permissions are defined programmatically via PluginPermissionService. The pattern — which carries forward into OpenELIS Global 2's module binding — is:
// From openelisglobal-core Analyzer Plugin model:
SystemModule module = service.getOrCreateSystemModule(
"AnalyzerResults", // action name
"WeberAnalyzer", // sub-type / component
"Results->Analyzer->WeberAnalyzer" // display path
);
Role role = service.getSystemRole("Results entry");
service.bindRoleToModule(role, module);
In OpenELIS Global 2, this same concept is realised through Keycloak client roles and Spring Security annotations. Each system module maps to a Keycloak role or scope claim, and Spring controllers use @PreAuthorize or role-based SecurityConfig rules to enforce access.
2.4 Permission Enforcement Layers
Layer | Mechanism | Example |
|---|---|---|
Keycloak (IAM) | Issues JWT with realm_access.roles claim | Token contains ["Results entry", "Validation"] |
Spring Security | @PreAuthorize, SecurityFilterChain rules | @PreAuthorize("hasRole('VALIDATION')") |
Spring MVC Controller | Role check before business logic executes | Controller rejects request if role missing |
React UI | Role-based conditional rendering | Validate Results button hidden unless role present |
Database (Audit) | All writes stamped with userId for audit trail | Immutable log of who changed what and when |
3. Roles
A role is a named collection of permissions that models a job function or responsibility within the laboratory. In OpenELIS Global 2, roles are defined and managed in Keycloak, issued as JWT claims, and enforced by Spring Security on the backend.
3.1 Role Architecture
OpenELIS Global 2 uses Keycloak as its IAM provider. Roles exist at two levels in Keycloak:
Realm Roles — available to all clients in the OpenELIS realm; used for cross-cutting roles like Global Admin
Client Roles — scoped to the OpenELIS application client; used for lab-workflow roles
When a user logs in, Keycloak issues a signed JWT (access token). The token includes a realm_access.roles array containing the user's roles. Spring Security validates this token on every request and extracts the roles to make authorization decisions.
3.2 Core Roles in OpenELIS Global 2
Role Name | Category | Primary Responsibilities |
|---|---|---|
Global Admin | Administrative | Full system access — user management, system configuration, all modules |
Lab Supervisor | Supervisory | Oversight of lab operations, result validation, overrides, escalations |
Results Entry | Operational | Enter and manage test results from analyzers or manual input |
Results Validator | Operational | Review, approve, and reject test results before release to clinicians |
Receptionist / Accession | Operational | Patient registration, sample intake, order creation |
Referring Clinician | Clinical | View validated results for referred patients (read-only) |
Report Viewer | Reporting | Access to aggregate reports, dashboards, and exports |
FHIR Puller / Pusher | Integration | Interoperability roles for FHIR-based order/result exchange |
From release notes: 'Ozone Features (initializer + SAML SSO roles)' and 'filter lab units by user roles on the activity' — demonstrating that role-based filtering is actively applied to both UI views and data queries in the system.
3.3 Role–Permission Binding Example
The following illustrates how a Results Entry role maps to system module permissions, based on the plugin permission model used throughout the codebase:
Role: Results Entry
├── Module: AnalyzerResults (READ, WRITE)
├── Module: ManualResults (READ, WRITE)
├── Module: SampleTracking (READ)
└── Module: OrderManagement (READ)
Role: Results Validator
├── Module: AnalyzerResults (READ, VALIDATE)
├── Module: ManualResults (READ, VALIDATE, UPDATE)
└── Module: ResultReporting (EXECUTE)
Role: Global Admin
└── ALL modules — CONFIGURE, READ, WRITE, UPDATE, DELETE, EXECUTE3.4 Role Assignment Flow
The process for assigning roles to users in OpenELIS Global 2 follows this sequence:
Administrator creates a user in Keycloak admin console (or via SAML/SSO federation)
One or more roles are assigned to the user within the OpenELIS Keycloak realm
User logs in — Keycloak authenticates credentials and issues a signed JWT
JWT contains realm_access.roles (realm roles) and resource_access.<client>.roles (client roles)
Spring Security validates the JWT signature against Keycloak's JWKS endpoint
Role claims are extracted and loaded into the Spring Security context
Every API endpoint or controller checks the security context before processing
React UI reads role context from the authenticated session and renders conditionally
4. Scopes
Scopes define the boundary within which a permission applies. In OpenELIS Global 2, scopes operate across three dimensions: functional (which module), data (which subset of records), and temporal (which time range of records).
4.1 Functional Scopes
Functional scopes correspond to the system modules that OpenELIS groups features into. A role may be scoped to one or many of these modules:
Functional Scope / Module | Description | Example Actions |
|---|---|---|
Patient Management | Create, view, and update patient demographics | Register patient, search patient records |
Sample / Accession | Sample intake, labelling, and tracking | Accession new sample, print barcode |
Order Management | Lab test ordering and order lifecycle | Create order, link to FHIR ServiceRequest |
Results Entry | Manual or analyzer-imported result entry | Enter CBC values, import analyzer file |
Result Validation | Review and approval of results | Approve, reject, or flag results |
Result Reporting | Generate and deliver patient reports | Print report, send to clinician |
Inventory | Reagent and supply tracking | Log stock, set reorder thresholds |
Administration | User management, system configuration | Add user, configure test catalog |
FHIR / Interoperability | External system data exchange | Push results to OpenHIM, pull FHIR orders |
Reports & Analytics | Aggregate reporting and exports | Run workload report, export CSV |
4.2 Data Scopes
Data scopes restrict which subset of records a role can act on. OpenELIS Global 2 supports several data-scope patterns:
Lab Unit / Test Section Scope — a technician or supervisor may be scoped to a specific test section (e.g., Hematology, Microbiology), restricting their activity views and data queries to only that unit
Own-Records Scope — an analyst or technician typically sees and modifies only records they entered or are assigned to
All-Records Scope — supervisors and administrators can see and act on records across all lab units
Patient Cohort Scope — referring clinicians are scoped to results for their own referred patients only
From the release history: 'filter lab units by user roles on the activity' — confirming that test section (lab unit) data scoping is enforced at the query level based on the user's assigned roles.
4.3 Temporal Scopes
Temporal scopes define what time range of data a user can access:
Temporal Scope | Description | Applies To |
|---|---|---|
Active Records | Currently open samples and in-progress results | Technicians, Validators |
Historical Records (Read-Only) | Completed and archived records | Supervisors, Report Viewers, Clinicians |
Full Archive | All records including deleted/voided entries | Global Admins only |
4.4 OAuth2 Scopes (Keycloak)
At the Keycloak/OAuth2 level, scopes govern what claims are included in the JWT and what resource servers the token is valid for. OpenELIS Global 2 uses the following standard OAuth2 scopes in its Keycloak realm configuration:
openid — required for OpenID Connect; enables issuance of an ID token alongside the access token
profile — includes user profile claims (name, preferred_username) in the token
offline_access — grants a refresh token for long-lived sessions (used by analyzer integrations)
roles — custom scope mapper that includes realm and client role claims in the JWT payload
These scopes are configured per-client in Keycloak and are reflected in the Spring Security application.properties:
# From Spring Security OAuth2 resource server config pattern:
spring.security.oauth2.resourceserver.jwt.issuer-uri=
http://keycloak:8080/realms/OpenELIS
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=
http://keycloak:8080/realms/OpenELIS/protocol/openid-connect/certs5. Role Types
OpenELIS Global 2 organises roles into four functional categories. Each category represents a distinct access posture and maps to a different set of system modules and permissions.
5.1 Administrative Roles
Administrative roles provide the highest levels of access and are responsible for system configuration, user management, and oversight.
Role | Access Level | Key Capabilities |
|---|---|---|
Global Admin | Full system | User CRUD, all module config, all data, system properties, FHIR settings |
Lab Supervisor | Lab-wide operational | Validate results, override technician entries, lab unit management, escalation handling |
5.2 Operational / Workflow Roles
Workflow roles drive the day-to-day laboratory process. Each maps to a specific stage in the lab workflow and holds permissions only for that stage.
Role | Workflow Stage | Key Permissions |
|---|---|---|
Receptionist / Accession Clerk | Sample Intake | Register patients, create orders, accession samples, print barcodes |
Results Entry | Result Capture | Enter results manually or import from analyzers, view orders |
Results Validator | Result Review | Validate / reject results, view result history, trigger report generation |
The analyzer integration docs confirm: 'The user should be added with the results entry roles' for systems that push analyzer files to OpenELIS — showing that the Results Entry role is the required minimum for automated result import.
5.3 Clinical / External Roles
Clinical roles are designed for healthcare providers who consume laboratory results rather than producing them. These roles are read-only within OpenELIS.
Role | Access | Scope Restriction |
|---|---|---|
Referring Clinician / Physician | View validated results | Only results for their own referred patients |
External System User | FHIR API read/write | Results and orders via FHIR endpoints only; no UI access |
5.4 Integration / Interoperability Roles
Integration roles are assigned to service accounts used by external systems (OpenMRS, OpenHIM, FHIR servers) that exchange data with OpenELIS. These are not human user roles.
Role | Direction | Protocol / Use Case |
|---|---|---|
FHIR Pusher | OpenELIS → External | Push validated results to an external FHIR server or OpenHIM |
FHIR Puller | External → OpenELIS | Pull lab orders from a FHIR server into OpenELIS |
Analyzer Import User | Analyzer → OpenELIS | Authenticate analyzer perl script submissions; requires Results Entry role |
SAML SSO Role | Identity Provider → OpenELIS | Federated role assigned via SAML SSO (e.g., Ozone integration) |
5.5 Composite / Hierarchical Roles (Keycloak)
Keycloak supports composite roles — roles that contain other roles. OpenELIS can use this to simplify assignment of complex role combinations:
// Composite Role example in Keycloak realm config:
Composite Role: Senior Lab Technician
├── includes: Results Entry (full permissions)
└── includes: Results Validator (own-results scope only)
Composite Role: Lab Manager
├── includes: Lab Supervisor
├── includes: Report Viewer
└── includes: Results Validator
Composite roles allow administrators to assign a single named role that grants appropriate access for complex job functions, without manually assigning multiple individual roles to each user.
6. How Permissions, Roles, and Scopes Work Together
The following illustrates the end-to-end chain from user login to data access in OpenELIS Global 2:
User (Lab Technician — Hematology unit)
└── assigned in Keycloak:
Realm roles: [Results Entry]
Client roles: [lab-unit:hematology]
JWT payload (simplified):
realm_access.roles: ["Results Entry"]
resource_access.openelis.roles: ["lab-unit:hematology"]
Spring Security extracts roles → SecurityContext
API: POST /results/enter
→ Spring checks: hasRole('RESULTS_ENTRY') ✓
→ Service checks: lab unit = hematology ✓
→ Action permitted: write result for hematology sample
React UI:
→ Validate Results button: HIDDEN (no VALIDATION role)
→ Enter Results section: VISIBLE
→ Lab unit filter: hematology only
Concept | Where Defined | Where Enforced | OpenELIS Source Reference |
|---|---|---|---|
Permission | SystemModule binding (Java / DB) | Spring @PreAuthorize, SecurityFilterChain | PluginPermissionService, bindRoleToModule() |
Role | Keycloak realm / client roles | JWT validation in Spring Security | Keycloak OpenELIS-realm.json; Spring OAuth2 resource server config |
Functional Scope | System module definitions | Controller and service layer checks | SystemModule, system_module DB table |
Data Scope | Keycloak client role (lab-unit:*) | Service layer query filtering | filter lab units by user roles (release #1374) |
Temporal Scope | Application logic | DAO / repository query predicates | Active vs. historical record access patterns |
7. Configuration Reference
7.1 Keycloak Realm Setup
OpenELIS Global 2 ships with a Keycloak realm JSON configuration file in the install/keycloak/ directory of the repository. This file seeds the initial realm, clients, and roles during Docker setup. Key elements:
Realm name: OpenELIS (or configurable via .env)
Client: openelis-client — the Spring Boot application registered as an OIDC confidential client
Roles: seeded with all standard workflow roles (Global Admin, Results Entry, Results Validator, etc.)
Role mappers: configured to include realm_access.roles in the JWT token claims
7.2 Docker Compose Integration
Keycloak is started as a service within the OpenELIS Docker Compose stack. The .env file controls:
KEYCLOAK_ADMIN / KEYCLOAK_ADMIN_PASSWORD — Keycloak admin credentials
Realm import — the realm JSON is imported on first startup via the --import-realm flag
OpenELIS Spring properties — issuer-uri and jwk-set-uri are injected from environment variables
7.3 Adding a New Role
To create a custom role in a running OpenELIS Global 2 instance:
Log into the Keycloak admin console at /auth/admin
Select the OpenELIS realm → Roles → Create role
Name the role (e.g., Pathology Supervisor) and save
Optionally make it a composite role by adding existing roles under the Roles tab
Assign the new role to target users in the Users → Role Mappings section
If backend enforcement is needed, add the role check to the relevant Spring Security config or @PreAuthorize annotation
On the React frontend, add a conditional check in the relevant component using the auth context
References
Source: http://github.com/DIGI-UW/OpenELIS-Global-2 | Branch: develop | Stack: Spring Boot · Keycloak · React
📋 Last reviewed: 2026-05 · Applies to: OpenELIS Global 3.2.x · Maintained by: the OEG documentation team · Suggest a change