Skip to main content

Role-Based Access Control

This page documents the role-based access control (RBAC) system used across SureClinical, and how it governs access to SureDrive features, routes, and operations. It covers the role taxonomy defined in the Java backend, the Angular frontend enforcement layer, and the administration UI for managing roles and features.


Architecture Overview

SureClinical RBAC operates on two parallel role dimensions that are combined per user:

DimensionPurposeStored In
System RolePlatform-level authority (Admin, Editor, Viewer, etc.)user.systemRole on the cached user object
User RoleCustom named role configured by admins; mapped to one or more application rolesuser.userRole on the cached user object

A User Role groups one or more Application Roles. Each Application Role belongs to a specific product (Archives/eTMF, CTMS, Network, QMS). Application Roles control which Application Features (individual UI capabilities) a user can access within that product. SureDrive uses the Archives (System / eTMF) application role set.


Role Taxonomy — Java Backend

UserRoleType Enum

File: SC/suredms-common/src/main/java/com/sureclinical/suredms/entity/UserRoleType.java

Defines the six role categories used across the platform:

Enum ValueValueDisplay NameRole ID PrefixApplication Role?
TYPE_ROLE0User Rolesuredms_No (user-facing role)
TYPE_ORGANIZATION1Organization (Legacy)suredms_No (legacy)
TYPE_SYSTEM2Archives (System)suredms_etmf_Yes — required
TYPE_CTMS3CTMSsuredms_ctms_Yes
TYPE_NETWORK4Networksuredms_network_Yes
TYPE_QMS5QMSsuredms_qms_Yes

isApplicationRole() returns true for all types except TYPE_ROLE and TYPE_ORGANIZATION. TYPE_SYSTEM (Archives) is the required application role — it cannot be omitted from a user role definition. canGrantFeatureAccess() returns true for both application roles and the legacy organisation type.

APPLICATION_ROLE_TYPES is a computed constant holding all application role types, used wherever the system needs to iterate over configurable product roles.

SureRoles — Role ID Constants

File: SC/suredms-common/src/main/java/com/sureclinical/suredms/common/SureRoles.java

Central registry of all role ID strings and reserved usernames.

Role ID prefixes:

Prefix ConstantValueApplication
ROLE_PREFIXsuredms_Platform / User Roles
ETMF_ROLE_PREFIXsuredms_etmf_Archives / SureDrive
CTMS_ROLE_PREFIXsuredms_ctms_SureCTMS
NETWORK_ROLE_PREFIXsuredms_network_SureNetwork
QUALITY_ROLE_PREFIXsuredms_qms_SureQMS

Platform / User Role IDs (prefix suredms_):

ConstantRole IDDescription
ROLE_SYSTEM_ADMINsuredms_system_adminInternal system administrator
ROLE_SYSTEM_APPsuredms_system_appInternal system application user
ROLE_ADMINsuredms_adminPlatform administrator
ROLE_USER_MANAGERsuredms_user_managerUser management only
ROLE_EDITORsuredms_editorContent editor
ROLE_VIEWERsuredms_viewerRead-only viewer
ROLE_AUDITORsuredms_auditorAudit-only access
ROLE_SPONSORsuredms_sponsorSponsor (external viewer)
ROLE_STUDY_ADMINISTRATORsuredms_study_administratorStudy/drive administrator
ROLE_PROJECT_EDITORsuredms_project_editorProject-scoped editor
ROLE_FINANCE_EDITORsuredms_finance_editorFinance-scoped editor
ROLE_HUB_USERsuredms_hub_userExternal hub user
ROLE_ETMF_ADMINsuredms_etmf_adminAlias for Archives Admin

Network roles (suredms_network_): viewer, editor, admin, hub_user

QMS roles (suredms_qms_): viewer, auditor, editor, training_manager, documents_manager, admin, department_manager, hub_user

Internal / reserved usernames: Administrator, scsystem, scapp, guest. These accounts are excluded from licence counts and cannot be assigned signing roles.

Internal roles (hidden from admin UI): administrators, suredms_system_admin, suredms_system_app.

PredefinedRoles Enum

File: SC/suredms-common/src/main/java/com/sureclinical/suredms/common/PredefinedRoles.java

Defines the ten built-in roles that are created by default on every SureClinical installation. Each predefined role carries IDs for all four application surfaces.

EnumDisplay NameUser Role IDeTMF Role IDCTMS Role IDNetwork RoleQMS Role
ADMINAdminsuredms_adminsuredms_etmf_adminsuredms_ctms_adminnetwork_adminqms_admin
USER_MANAGERUser Managersuredms_user_managersuredms_etmf_user_managersuredms_ctms_user_managernetwork_editorqms_viewer
STUDY_ADMINISTRATORStudy Administratorsuredms_study_administratorsuredms_etmf_study_administratorsuredms_ctms_study_administratornetwork_editorqms_viewer
EDITOREditorsuredms_editorsuredms_etmf_editorsuredms_ctms_editornetwork_editorqms_editor
VIEWERViewersuredms_viewersuredms_etmf_viewersuredms_ctms_viewernetwork_viewerqms_viewer
AUDITORAuditorsuredms_auditorsuredms_etmf_auditorsuredms_ctms_auditornetwork_viewerqms_auditor
PROJECT_EDITORProject Editorsuredms_project_editorsuredms_etmf_project_editorsuredms_ctms_project_editornetwork_editorqms_viewer
FINANCE_EDITORFinance Editorsuredms_finance_editorsuredms_etmf_finance_editorsuredms_ctms_finance_editornetwork_editorqms_viewer
SPONSORSponsorsuredms_sponsorsuredms_etmf_sponsorsuredms_ctms_sponsornetwork_viewerqms_viewer
HUB_USERHub Usersuredms_hub_usersuredms_etmf_hub_usersuredms_ctms_hub_usernetwork_hub_userqms_hub_user

getApplicationRoleId(UserRoleType application) resolves the correct role ID for a given application surface. DEFAULT_ROLES, DEFAULT_ETMF_ROLES, DEFAULT_CTMS_ROLES, DEFAULT_NETWORK_ROLES, and DEFAULT_QUALITY_ROLES in SureRoles are computed from these predefined values.

PredefinedRoles.toEtmfRole(role) and toCtmsRole(role) convert a user role ID to the corresponding eTMF/CTMS application role ID — used during study-level role assignment for SureDrive and SureETMF.


Frontend Role Constants

File: SC/suredms-web-client/src/main/webapp/app/js/common/user.js

The web client mirrors the Java role registry with JS constants used throughout Angular controllers.

System role ID constants:

JS ConstantValue
SYSTEM_ROLE_SYSTEM_ADMINsuredms_system_admin
SYSTEM_ROLE_ADMINsuredms_etmf_admin
SYSTEM_ROLE_STUDY_ADMINsuredms_etmf_study_administrator
SYSTEM_ROLE_EDITORsuredms_etmf_editor
SYSTEM_ROLE_PROJECT_EDITORsuredms_etmf_project_editor
SYSTEM_ROLE_FINANCE_EDITORsuredms_etmf_finance_editor
SYSTEM_ROLE_VIEWERsuredms_etmf_viewer
SYSTEM_ROLE_AUDITORsuredms_etmf_auditor
SYSTEM_ROLE_SPONSORsuredms_etmf_sponsor

Role group arrays used for access checks:

ArrayMembers
ADMIN_ROLESadministrators, suredms_system_admin, suredms_system_app, suredms_etmf_admin
SYSTEM_ROLESsuredms_system_admin, suredms_system_app
AT_LEAST_ADMIN_ROLESAll ADMIN_ROLES + suredms_etmf_study_administrator
AT_LEAST_EDITOR_ROLESAll AT_LEAST_ADMIN_ROLES + editor variants (editor, project_editor, finance_editor)

User-facing role objects (USER_ROLE_*) carry { id, name, style, rank } and form the USER_ROLES sorted array used in the admin UI for filtering and display styling.


UserService — Frontend Authorization API

File: SC/suredms-web-client/src/main/webapp/app/js/common/user.js (Angular service UserService)

UserService is the primary authorization API consumed by Angular controllers, components, and route guards. All checks read from CacheService.getCurrentUser() (or a named user from the system snapshot) and compare against the role group arrays above.

Identity Checks

MethodReturns true when
isSystemUser(username?)User is scsystem or scapp (internal system accounts)
isSystemAdministratorUser(username?)Username equals scsystem exactly
isSystemApplicationUser(username?)Username equals scapp exactly
isSystemAdminUser(username?)Username equals admin exactly
isExternal(username?)user.external === true
isExcludedFromLicenseUser(username?)Is a system or admin user; does not consume a licence

Privilege Checks

MethodAccess LevelTypical Use
isSystemAdmin(username?)SYSTEM_ROLESGuard internal-only operations
isAdmin(username?)ADMIN_ROLESShow admin-only UI, gate user CRUD, import/export
isAtLeastAdmin(username?)AT_LEAST_ADMIN_ROLESIncludes Study Administrator; used for date format settings
isAtLeastEditor(username?)AT_LEAST_EDITOR_ROLESIncludes all editing roles
isViewer(username?)Role equals SYSTEM_ROLE_VIEWERRead-only fallback state
isSystemAdministratorUser()Username is scsystemServer configuration edit guard
hasRole(role, username?)Role ID equals user.systemRole exactlyPoint-specific role check

Representative Usage Patterns

// Gate admin-only actions in the Users controller
UserService.isAdmin() // show Import from AD, Export to Excel, etc.

// Gate feature editing in server configuration panels
UserService.isSystemAdministratorUser() // server.js: isFeaturesEditable

// Gate signing certificate downloads
UserService.isAdmin() // user-signing-certificate.js: canDownloadCertificate

// Prevent system accounts from appearing in signers list
!UserService.isSystemUser(user.username) && !UserService.isSystemAdminUser(user.username)

// Allow editing a user only if the current user outranks the target
UserService.canEditUser(targetUsername)
// Internally: compares systemRole ranks using getSubSystemRoles()

Role Rank Hierarchy

getSubSystemRoles(role) computes which roles a user can manage by comparing rank values from the USER_ROLES array. Higher rank = more authority. A user can edit or manage users whose systemRole.rank is ≤ their own rank. The rough ranking is: System Admin (10) > Admin (5) > Study Admin (3) > Editor/Project Editor/Finance Editor (2) > Viewer/Auditor/Sponsor (2).

User Data Model

Each user object in the system snapshot carries:

FieldDescription
usernameUnique login name
systemRoleeTMF (Archives) system role ID string — primary authority level
userRoleCustom user role ID — maps to application roles
externalBoolean; external Hub Users
activeBoolean; inactive users cannot log in
archivesArray of study/drive archive objects the user belongs to
projectsArray of CTMS project objects
featuresArray of enabled feature IDs for this user

Route Guards and Access Enforcement

requireLogin

All protected routes in SC/suredms-web-client/src/main/webapp/app/js/state/app-states.js carry data: { requireLogin: true } in their state definition. The Angular router run block checks this flag on every state transition and redirects unauthenticated users to the login page.

requireRule

Some routes additionally carry data: { requireRule: NAVIGATION_RULE_* }. Rule constants (e.g., NAVIGATION_RULE_DOCUMENTS_MIGRATION) are evaluated at navigation time and can gate access to features like document migration based on the user's role and enabled modules.

Controller-Level Guards

Most feature-gating happens inside individual Angular controllers, not at the route level:

// Integration manager: only admins or system admins can edit
integrationManager.isEditable = UserService.isAtLeastAdmin() || UserService.isSystemAdministratorUser();

// Administration dashboards: only admins
administrationUser.isCurrentUserAdmin = UserService.isAdmin();

// Server configuration panels: only system admin
administrationServer.isFeaturesEditable = UserService.isSystemAdministratorUser();

// Signing setup wizard: skip system users
if (UserService.isSystemUser(username) || UserService.isSystemAdminUser(username)) { ... }

Administration UI — Roles and Permissions

Accessing Role Administration

Navigate to Administration → User Roles in the SureClinical dashboard.

Help file: Help/contents/Content_Repo/Viewing_and_Managing_User_Organization_Roles_and_Person_Roles.htm

The page shows three panels:

  1. Applications and User Roles — graphical matrix of user roles, application roles, and user counts. Filter by application type (Archives/System, CTMS).
  2. User Roles — list of all named user roles, each showing its mapped application roles.
  3. Applications and Application Roles — per-application role list (Archives, CTMS, Network, QMS).

Creating and Managing User Roles

Help file: Help/contents/Content_Repo/Creating_and_Managing_User_Roles.htm

A User Role bundles one application role per product. Creating a new role:

  1. Click +, enter a User Role Name.
  2. For each SureClinical application (Archives, CTMS, Network, QMS), select the Application Role to assign.
  3. Click Create.

Editing: click the role name to enter the Application Features view. Select which sub-features within each application role are accessible to users bearing this role. Click Update to save.

All users assigned to a User Role inherit both the chosen Application Roles and the selected Application Features.

Creating and Managing Application Roles

Help file: Help/contents/Content_Repo/Creating_and_Managing_Application_Roles.htm

Application roles are per-product permission containers. Creating a new application role:

  1. Click +, enter a Name and select the Type (Archives, CTMS, Network, or QMS).
  2. Click Create.

Editing: click the role name to see the feature checklist for that application. Toggle individual features on or off and click Update. Use the overflow menu to switch between application types (Archives, CTMS, Network, QMS) when viewing or assigning features.

Application Features

Help file: Help/contents/Content_Repo/Configuring_SureClinical_Application_Features.htm

Application features are the finest-grained permission unit. They are grouped by product and include both system-level features (e.g., External User Creation, Flex editor access) and module-specific features (e.g., Administrative Reports tab). Assigning a feature to an Application Role makes it available to every User Role that includes that Application Role.

The server-side operation constants for role-related reports are defined in SureOperations:

Operation ConstantValue
OP_MOBILE_GET_APPLICATION_ROLES_REPORTMobile.GetApplicationRolesReport
OP_MOBILE_GENERATE_APPLICATION_ROLES_REPORTMobile.GenerateApplicationRolesReport
OP_MOBILE_GET_USER_ROLES_REPORTMobile.GetUserRolesReport
OP_MOBILE_GENERATE_USER_ROLES_REPORTMobile.GenerateUserRolesReport

RBAC in SureDrive Context

Who Can Do What in SureDrive

ActionMinimum Required Role
View SureDrive documentsViewer (suredms_etmf_viewer)
Upload documents, initiate workflowsEditor (suredms_etmf_editor) or above
Manage content model, blinding rules, propertiesStudy Administrator (suredms_etmf_study_administrator) or above
Create or delete a SureDriveAdmin (suredms_etmf_admin)
Export / lock a SureDriveAdmin
Configure server settings, application featuresSystem Administrator (scsystem username)
Sign documents without a workflowAdmin or Study Administrator
Manage users and user rolesAdmin (isAdmin() = true)
Download signing certificatesAdmin
Manage integration / connector configurationisAtLeastAdmin() or isSystemAdministratorUser()

Study-Level Role Assignment

When a user is added to a SureDrive via the Team menu, their userRole is translated to an eTMF-scoped application role using PredefinedRoles.toEtmfRole(role). This mapped eTMF role governs their permissions within that specific drive, independently of what other drives they may belong to.

External Hub Users (HUB_USER) receive a restricted application role (suredms_etmf_hub_user) which limits their access to shared content only.

Blinding Rules and Document Visibility

Blinding Rules (see the SureDrive Properties page) layer additional per-folder, per-user access restrictions on top of the system role. A user's role may grant general read access, but blinding rules can further restrict which content types they see within a drive. Visibility can also be configured at the individual document level from the Documents area.

Feature Flag Interaction

ProvisioningCacheService.isModuleEnabled(MODULE_*) gates certain role-based actions behind active module licences. For example, importing pending users from Active Directory requires both isAdmin() and isModuleEnabled(MODULE_LABORATORY) to be true simultaneously.


Permissions Layer

While roles define who a user is, the permissions layer enforces what a user can do at the document, archive, feature, and network level. The classes and services below sit between the role taxonomy and the actual UI/API operations.


DocumentPermissionsHelper — Document-Level Permission Gate

File: SC/suredms-desktop-client/src/main/java/com/sureclinical/suredms/permissions/DocumentPermissionsHelper.java

DocumentPermissionsHelper is the authority on whether the current user may perform any operation on a specific document. It is constructed with a Document instance and resolves the current User from DesktopClient. On construction it computes all state flags once; callers query individual boolean methods.

State evaluated at construction:

FlagSource
isSureDriveDocumentdocument.isCloudDocument()
isReadOnlyArchiveUserVisibilityHelper.isArchiveWriteable() + archive.isLocked()
isRemoteArchivearchive.isRemote()
isHierarchyLockedAny parent folder is locked (unless user is whitelisted)
isLockedDocument itself is locked (unless user is whitelisted)
isEffectivelyReadOnlyUnion of above + isEntityWriteable, checked-out state, site-document flag, quality archive flag

Key permission methods:

MethodReturns true when
isEffectivelyReadOnly()Document cannot be modified by this user
isSignable()PDF mime type + not yet certified
canBeMovedToArchive()Queued doc, not read-only, acquire queue feature enabled, document complete
canBeMovedToQueue()Regular doc, not read-only, acquire feature enabled; for SureDrive docs also checks per-drive acquire queue setting
canEditPdf()Not read-only, not signed, PDF mime type, exportable
isMimeTypePdf()Document blob is application/pdf
isExportable()InstanceRestrictionsHelper.isExportable(document)

DocumentPermissionsHelper is imported in WorkflowPlatformServiceImpl, WorkflowNavigatorPanel, and NuxeoHelper to enforce document-level constraints within workflow and Nuxeo integration code paths.


FeatureSnapshotHelper — Feature-to-Role Permission Engine

File: SC/suredms-common/src/main/java/com/sureclinical/suredms/common/objects/FeatureSnapshotHelper.java

FeatureSnapshotHelper wraps a FeatureSnapshot (a data transfer object loaded from the server) and provides efficient lookup of whether a given application role has access to a given feature flag.

Internal structure:

  • permissions: Map<featureKey, Map<roleId, FeatureSnapshotItem>> — the full matrix of feature × role entries.
  • enabledFeaturesForRole: Multimap<roleId, featureKey> — fast iteration of all enabled features for one role.
  • featuresById: Map<featureKey, FeatureDescriptionDto> — feature metadata for display.

Key methods:

MethodPurpose
getFeaturePermissions(role, featureKey, defaultValue)Returns boolean — whether the role has access to the feature; falls back to defaultValue if not configured
getFeaturePermissions(role, List<BasicFeatureDescription>)Returns Map<featureKey, Boolean> for a set of features at once
getEnabledFeatures(roleId)Returns the display-name list of all features enabled for a role
getFeatureKeys()Ordered list of all feature keys in the snapshot
getRoles()Ordered list of all role IDs in the snapshot

FeatureSnapshotHelper is used in:

  • AbstractFeatureManager (desktop connector) — delegated to via getFeaturePermissions(role, featureKey) to gate desktop features per role.
  • ApplicationConfigurationParser (parser) — used to render an "X" cell in the exported feature-permission matrix spreadsheet.

ExpandedArchiveAclRule — Archive ACL Model

File: SC/suredms-common/src/main/java/com/sureclinical/suredms/common/objects/ExpandedArchiveAclRule.java

An ExpandedArchiveAclRule represents a single access control rule for an archive (SureDrive or study). It carries the following permission dimensions:

DimensionFields
Rule metadataid, active, unrestricted, permissionType (READ_WRITE or restricted)
TargetarchiveId — the specific archive this rule applies to
Usersusers — set of user IDs explicitly covered
Archivesarchives — set of child archive IDs
Content typescontentTypes, hiddenContentTypes, writableContentTypes
Organizationsorganizations, hiddenOrganizations, writableOrganizations
Documentsdocuments, hiddenDocuments

The hidden* sets define what content the matching users cannot see; the writable* sets define what they can edit. This model supports the blinding rules system described in the SureDrive context section above.


UserRolesApplicationFeaturesService — Frontend Feature Permission Editor

File: SC/suredms-web-client/src/main/webapp/app/js/administration/roles/user-roles-application-features-service.js

Angular service UserRolesApplicationFeaturesService is the frontend-side counterpart to FeatureSnapshotHelper. It drives the Application Features editing UI in Administration → User Roles.

APPLICATION_PERMISSIONS map:

Maps application type IDs to the feature flags that control whether that application is accessible at all:

App Type IDConstantFeatures Mapped
2 (Archives)ARCHIVES_APPLICATION_TYPE_IDFEATURE_ETMF_APPLICATION_ENABLED, FEATURE_SURE_DRIVE_APPLICATION_ENABLED, FEATURE_SURE_HUB_APPLICATION_ENABLED, FEATURE_SURE_ISF_APPLICATION_ENABLED, FEATURE_SURE_QMS_APPLICATION_ENABLED
3 (CTMS)CTMS_APPLICATION_TYPE_IDFEATURE_CTMS_APPLICATION_ENABLED
4 (Network)NETWORK_APPLICATION_TYPE_IDFEATURE_NETWORK_APPLICATION_ENABLED

FEATURES_TO_HIDE is a list of application-enable feature IDs that are suppressed from the feature checklist to prevent admins from accidentally disabling an entire product through the per-role editor.

Key methods:

MethodPurpose
getFeaturesFromApplication(application)Collects {featureKey, role, access} snapshot items from current checkbox state for a given application panel
createApplication(application, features, role)Builds an application panel model from the feature list and role; splits Archives into "System" and "Archives" sub-panels

NetworkPermissionService — Hub and Project Permission Checks

File: SC/suredms-web-client/src/main/webapp/app/js/ (injected Angular service)

NetworkPermissionService resolves whether the current user can edit a SureNetwork hub or project. It is consumed by:

ConsumerUsage
store/store.jsstore.canEditProjectHub = NetworkPermissionService.canEditHub(hub)
portal/portal-context.jsGates project editing in the portal dashboard
network/workspace/projects/workspace-projects.jsControls write access to workspace project records

Permissions in Reports

Role and permission data is also exposed through the reporting system:

Report TypeConstantDescription
USER_ROLEReportType.USER_ROLELists all users and their assigned user roles
APPLICATION_ROLEReportType.APPLICATION_ROLELists application roles and their feature sets
USER_ACCESS_BY_ARCHIVEReportType.USER_ACCESS_BY_ARCHIVEShows per-archive user access permissions

Column constants (ReportConstants.USER_ROLES, ReportField.FIELD_USER_ROLES) and training certificate fields (TrainingCertificateFields.FIELD_USER_ROLES) make role data available in generated report output. Report generation is initiated via SureOperations.OP_MOBILE_GET_USER_ROLES_REPORT and OP_MOBILE_GENERATE_USER_ROLES_REPORT.


Key Source Files Reference

FilePurpose
SC/suredms-common/src/main/java/com/sureclinical/suredms/entity/UserRoleType.javaRole category enum; application role detection
SC/suredms-common/src/main/java/com/sureclinical/suredms/common/SureRoles.javaAll role ID strings, prefixes, reserved usernames, internal role set
SC/suredms-common/src/main/java/com/sureclinical/suredms/common/PredefinedRoles.javaTen default roles with cross-product IDs; role ID resolution and translation
SC/suredms-common/src/main/java/com/sureclinical/suredms/entity/UserRoleEntity.javaJava interface implemented by role entity objects
SC/suredms-web-client/src/main/webapp/app/js/common/user.jsJS role constants, USER_ROLES array, UserService Angular service
SC/suredms-web-client/src/main/webapp/app/js/state/app-states.jsRoute definitions with requireLogin and requireRule guards
SC/suredms-desktop-client/src/main/java/com/sureclinical/suredms/permissions/DocumentPermissionsHelper.javaDocument-level permission gate: read-only, lock, sign, move, edit, export, delete
SC/suredms-common/src/main/java/com/sureclinical/suredms/common/objects/FeatureSnapshotHelper.javaFeature-to-role permission engine; resolves (role, featureKey) → Boolean
SC/suredms-common/src/main/java/com/sureclinical/suredms/common/objects/ExpandedArchiveAclRule.javaACL rule model: per-archive user/content-type/organization/document access sets
SC/suredms-web-client/src/main/webapp/app/js/administration/roles/user-roles-application-features-service.jsFrontend feature permission editor; APPLICATION_PERMISSIONS map per app type
Help/contents/Content_Repo/Viewing_and_Managing_User_Organization_Roles_and_Person_Roles.htmEnd-user Help: User Roles and Application Roles overview
Help/contents/Content_Repo/Creating_and_Managing_User_Roles.htmEnd-user Help: creating and managing user roles
Help/contents/Content_Repo/Creating_and_Managing_Application_Roles.htmEnd-user Help: creating and managing application roles
Help/contents/Content_Repo/Configuring_SureClinical_Application_Features.htmEnd-user Help: application feature flags by product