Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Output: `package/target/rbac-1.3.0.zip`
- `initialize()` calls `getMyPermissions()` REST endpoint; lazy retry on first `checkTask()` if initial load fails
- Fail-closed: if permissions can't be loaded, tasks are denied
- Both role editors check a new or changed name or description before saving. If the server would refuse it, they show the server's message and keep the editor open. The Swing `RoleEditorDialog` calls `NameCharacters.editorRefusal` (shared module, the server's own rule); the web editor calls `editorRefusal` in `rbac-core.js`. `NameCharacterCasesTest` and `name-characters.test.mjs` both read `webadmin/web/name-character-cases.txt`, so the two rules give the same answers and show the same messages; `webadmin/e2e/role-editor.spec.js` checks the web editor in CI, and the Swing editor's check has no CI test. Before the check (measured on OIE 4.7.0), the Swing panel showed the engine's general error dialog, with a stack trace starting "400 Bad Request" and without rbac's message, and a bell in a description failed inside the Swing client before reaching rbac. In both editors the editor closed on Apply, and the edits were lost (owner's decision 2026-11-24)
- Export Roles and Import Roles (`settings_Role-Based Access Control/doExportRoles`, `/doImportRoles`) are admin-only tasks, not permissions: `checkTask` answers them from an admin flag loaded with the permissions (only when the user holds View Roles: the current user's id, then `getUserRole`; a failure leaves the flag unknown, which answers not admin, and the next check of an admin-only task retries the lookup at most once per 15 seconds). Gated in the controller, not the panel, because `Frame.setVisibleTasks` re-runs `checkTask` whenever it shows tasks. Web twin: `ADMIN_ONLY_TASKS` in `task-permission-map.js` and `adminOnlyTasks` in `task-permission-map.json`
- Export Roles, Import Roles and Orphaned Permissions (`settings_Role-Based Access Control/doExportRoles`, `/doImportRoles`, `/doShowOrphanedPermissions`) are admin-only tasks, not permissions: `checkTask` answers them from an admin flag loaded with the permissions (only when the user holds View Roles: the current user's id, then `getUserRole`; a failure leaves the flag unknown, which answers not admin, and the next check of an admin-only task retries the lookup at most once per 15 seconds). Gated in the controller, not the panel, because `Frame.setVisibleTasks` re-runs `checkTask` whenever it shows tasks. Web twin: `ADMIN_ONLY_TASKS` in `task-permission-map.js` and `adminOnlyTasks` in `task-permission-map.json`
- The export and import flows live in `RoleTransferActions`, `RoleExportDialog`, `RoleImportDialog` and `RoleImportText` (wording, default ticks; web twin in `rbac-core.js`). The file is written as plain UTF-8, never through `Frame.exportFile`, which encrypts when export encryption is on; `RoleImportFile` reads an import file, refusing one over 5 MB or not in UTF-8 before anything is sent

### Database
Expand All @@ -69,7 +69,8 @@ Output: `package/target/rbac-1.3.0.zip`
- Users: GET `/users/{userId}/role`, POST `/users/{userId}/role/{roleId}`, DELETE `/users/{userId}/role`
- Permissions: GET `/permissions` (all available), GET `/my-permissions` (current user's granted permissions), GET `/permissions/extensions` (extension permission → publishing plugin, for the role editors' per-plugin headers), GET `/task-permissions` (extension task → permission, whitelisted for all users)
- Export/import: GET `/roles/_export?roleId=` (the file, `text/plain`), POST `/roles/_import?dryRun=&applyChannels=&matchChannelsByName=&pick=&planToken=` (the file as a `text/plain` body; preview, then apply the picked roles in one transaction). Format and rules: `docs/role-export-format.md`
- `@MirthOperation` annotations with `PERMISSION_VIEW = "View Roles"` and `PERMISSION_MANAGE = "Manage Roles"`. Export and import are admin-only: their operations are registered under View Roles and Manage Roles (so never unknown), `RbacAuthorizationController` refuses them to anyone without the admin role (`ADMIN_ONLY_OPERATIONS`, so the audit records a FAILURE, not a success), and `RoleTransferService` checks again
- Orphaned permissions: GET `/roles/_unregistered` (the grants no installed plugin registers, never the engine's own, and the names of the disabled plugins), POST `/roles/_unregistered/_remove` (the picked grants, each checked again; one transaction)
- `@MirthOperation` annotations with `PERMISSION_VIEW = "View Roles"` and `PERMISSION_MANAGE = "Manage Roles"`. Export, import and the orphaned-permissions calls are admin-only: their operations are registered under View Roles and Manage Roles (so never unknown), `RbacAuthorizationController` refuses them to anyone without the admin role (`ADMIN_ONLY_OPERATIONS`, so the audit records a FAILURE, not a success), and `RoleTransferService` checks again

### Role Export and Import
- `RoleTransferFormat` writes and strictly reads the file (format 1; DOCTYPE refused; no XStream). Unknown elements, attributes or format versions refuse the whole file, so a newer file is never partly read
Expand Down Expand Up @@ -97,7 +98,8 @@ Output: `package/target/rbac-1.3.0.zip`
- The admin role's retention floor is the **core** permission set, not core+extension. The seeder grants only core perms, and admin access is by the flag regardless of stored perms, so requiring extension perms just made the admin role uneditable.
- `manageExtensions` is effectively an admin-equivalent grant: a holder can disable the RBAC extension, and on the next restart the engine reverts to the always-allow `DefaultAuthorizationController` (every user becomes admin). The role editor tags it with a warning tooltip; treat it as a privileged grant. This mirrors stock OIE (manageExtensions = install/enable/disable plugins = arbitrary code).
- `Manage Roles` is for delegating user management, not a security boundary: a holder can give their own account any role, the admin role included (measured on OIE 4.7.0 with rbac 1.2.0). Both role editors tag it with a warning tooltip, like `manageExtensions`.
- Role export and import are admin-only, rbac's only operations that are (decided 2026-10-31, before 1.3.0 shipped). Importing is admin-level power anyway (see Manage Roles above), and the admin role sees every channel, so an export can name each one. Separate Export Roles and Import Roles permissions were built first and removed before release; adding a grantable permission later is additive, removing a shipped one is not
- Role export and import are admin-only (decided 2026-10-31, before 1.3.0 shipped). Importing is admin-level power anyway (see Manage Roles above), and the admin role sees every channel, so an export can name each one. Separate Export Roles and Import Roles permissions were built first and removed before release; adding a grantable permission later is additive, removing a shipped one is not
- The Orphaned Permissions list and removal (`UnregisteredGrantService`, `OrphanedPermissionsDialog`, `orphaned-permissions.jsx`) are admin-only too, checked again in the service. They only remove grants; granting a renamed permission's new name stays in the role editor. Engine permissions are never listed or removed. Nothing is listed when rbac can't read the engine's permissions or before the plugins' permissions are registered (rbac's own View Roles missing from the registered set). Removal deletes each picked grant by role and name, in one transaction. Every database's `UNIQUE (role_id, permission)` keeps a role from holding two names that differ only in case, also where the database compares them ignoring case (measured on MySQL 8.4 and SQL Server 2022). The dialog names installed plugins that are disabled: a disabled plugin stays in `getPluginMetaData`, reports disabled, and its permissions leave the catalog (measured on OIE 4.7.0 with Data Pruner). The dialog has no plugin column, because rbac doesn't remember which plugin registered a permission (owner's decisions 2026-11-23 and 2026-11-25)
- No role assigned = deny all (server-side), except a user's own account, password and preferences (`isSelfUserOperation`); fail-closed (client-side). A role restricted to no channel (`restricted` true, no rows) sees no channel; the Administrators' role editors allow "Specific Channels" with nothing ticked for exactly that (owner's decision 2026-11-04, replacing the every-channel meaning of an empty list)
- Unknown operations = allow (server-side fallback for login, infrastructure); `@DontCheckAuthorized` reads instead return `false` to degrade gracefully (see `DEGRADABLE_OPERATIONS`)
- VIEW_SETTINGS intentionally unmapped in client — always shown; individual settings tabs gated by group-specific permissions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ So when the engine or an extension declares a permission, RBAC enforces it with

The exception is the engine's user preference calls (each user's Administrator settings), which declare no permission in OIE 4.7.0. RBAC requires Manage Users for another user's preferences and allows every user their own. Once the engine declares a permission on them, RBAC uses that instead.

A role stores a plugin's permission by its display name, the name the role editors show for it, such as "View Server Log" (Server Log), "View Settings" (Data Pruner) or "View Global Maps" (Global Maps). If a new version of the plugin renames the permission, or the plugin is removed, the role keeps the old name, and that grant does nothing. After a rename, the role's users are refused the plugin's operations until an admin grants the new name, and RBAC logs the role and the old name the first time one of its users is refused for a missing permission after the engine starts. The role editors don't show such a grant, and saving the role keeps it, so it comes back into use if the plugin is installed again. Plugin authors: keep a permission's display name the same across versions.
A role stores a plugin's permission by its display name, the name the role editors show for it, such as "View Server Log" (Server Log), "View Settings" (Data Pruner) or "View Global Maps" (Global Maps). If a new version of the plugin renames the permission, or the plugin is removed, the role keeps the old name, and that grant does nothing. After a rename, the role's users are refused the plugin's operations until an admin grants the new name, and RBAC logs the role and the old name the first time one of its users is refused for a missing permission after the engine starts. The role editors don't show such a grant, and saving the role keeps it, so it comes back into use if the plugin is installed again. An admin can list and remove such grants with the Orphaned Permissions task in the RBAC tab; engine permissions are never listed there. Plugin authors: keep a permission's display name the same across versions.

The engine's plugin-settings calls (`/api/extensions/{name}/properties`) are allowed only under the exact name of an installed extension, and rbac's own settings only to the admin role.

Expand Down
Loading
Loading