Skip to main content
OpenEyes implements a comprehensive role-based access control (RBAC) system for managing user permissions across the application.

User Management

Accessing User Administration

The admin interface is accessible at /admin/users and is managed by the AdminController:
1

Navigate to Admin Section

Access via main menu → Admin → Users
2

Search for Users

Use the search box to filter by name, ID, or username
3

Add or Edit Users

Click “Add User” or select an existing user to modify

User Model Structure

The User model (protected/models/User.php) contains:
integer
Unique user identifier
string
required
User’s first name (max 40 characters)
string
required
User’s last name (max 40 characters)
string
required
User’s email address (max 80 characters)
string
Professional title (Dr, Mr, Mrs, Ms, etc.)
boolean
default:"1"
Whether user has access to all firms/contexts
boolean
Mark user as a consultant
boolean
Mark user as a surgeon (requires additional fields)
integer
Doctor grade (required if is_surgeon = 1)
string
Professional registration code (required for surgeons)
integer
Link to contact record with full details

Creating a New User

When creating a user, the system requires:
  1. Basic Information: Name, title, email
  2. Authentication: At least one institution authentication
  3. Roles: One or more system roles
  4. Context Access: Firm assignments (if global_firm_rights = 0)
When global_firm_rights is set to 0 (No), at least one firm must be assigned to the user or validation will fail.

User Authentication

OpenEyes supports multiple authentication methods per user through the UserAuthentication model.

Authentication Types

Local database authentication with password management.Features:
  • Password complexity requirements
  • Password expiration
  • Account lockout after failed attempts
  • Password history tracking
Configured via AUTH_SOURCE=BASIC environment variable.

UserAuthentication Model

File: protected/models/UserAuthentication.php
integer
Authentication record ID
integer
required
Reference to user
integer
required
Links to institution’s authentication method
string
required
Login username (max 40 characters)
string
Hashed password (for BASIC auth only)
string
Password salt (legacy, being phased out)
string
Status: current, expired, stale, or softlocked
integer
Failed login attempt counter
datetime
Last password change timestamp
boolean
default:"true"
Whether authentication is active

Password Management

OpenEyes automatically upgrades legacy password hashes to the modern password_hash() method on successful login.

Role-Based Access Control (RBAC)

OpenEyes uses Yii’s built-in RBAC system with three database tables:
  • authitem - Roles, tasks, and operations
  • authitemchild - Role hierarchy
  • authassignment - User role assignments

Default Roles

admin

System AdministratorFull access to all system features including:
  • User management
  • System settings
  • All institutions
  • Module administration

User

Standard UserBasic clinical access:
  • Patient records
  • Event creation
  • Clinical notes
  • Limited to assigned contexts

Prescribe

PrescriberPermission to prescribe medications:
  • Create prescriptions
  • Manage drug lists
  • View medication history

Med Administer

Medication AdministratorPermission to administer medications:
  • Record administration
  • Document adverse reactions

Edit

EditorEnhanced editing permissions:
  • Edit locked events
  • Modify historical data

View clinical

Clinical ViewerView-only clinical access:
  • Read patient records
  • View clinical events
  • No editing capabilities

Checking User Permissions

Managing User Roles

Firm/Context Management

Users can be restricted to specific firms (clinical contexts) when global_firm_rights = 0.

Firm Assignments

A “firm” in OpenEyes represents a clinical service or team, typically associated with:
  • A subspecialty (e.g., Cataract, Glaucoma, Retina)
  • A consultant or service lead
  • One or more sites
Users without global_firm_rights must have at least one firm assigned, or they cannot access clinical functionality.

PIN Code Management

OpenEyes supports PIN-based authentication for quick actions and signing:
PINs can be regenerated up to 5 times within a 12-month period for security purposes (see User.php:48).

Institution-Specific Users

Non-admin users are typically restricted to their assigned institution:

API Reference

User Methods

File: protected/models/User.php
  • getFullName() - Returns “FirstName LastName”
  • getFullNameAndTitle() - Returns “Title FirstName LastName”
  • getRoles() - Returns array of CAuthItem roles
  • hasRole($targetRole) - Check if user has specific role
  • saveRoles($roles) - Assign roles to user
  • saveFirms($firms) - Assign firms to user
  • getAvailableFirms() - Get firms user can access
  • generatePin($regenerate) - Generate or regenerate PIN

UserAuthentication Methods

File: protected/models/UserAuthentication.php
  • verifyPassword($password) - Verify password hash
  • handlePassword() - Process password on save
  • setPasswordHash() - Hash password before save
  • isLocalAuth() - Check if using local authentication

Security Best Practices

Strong Passwords

Configure password complexity requirements via pw_restrictions parameters

Least Privilege

Grant users only the roles they need for their work

Regular Audits

Review user accounts and permissions regularly

Disable Inactive Users

Set active = 0 on UserAuthentication for inactive accounts