refactor(rbac): consolidate role permissions and restructure role editor#517
Open
larsgeorge-db wants to merge 1 commit into
Open
refactor(rbac): consolidate role permissions and restructure role editor#517larsgeorge-db wants to merge 1 commit into
larsgeorge-db wants to merge 1 commit into
Conversation
Consolidate the duplicate `settings-*` permissions with their consumption-side
counterparts and reshape the role editor to mirror the actual sidebar layout
instead of an arbitrary flat list.
Backend (features.py):
- Drop `settings-data-domains`, `settings-business-roles`, `settings-delivery-methods`,
`settings-teams`, `settings-projects`, `settings-audit`, `settings-tags`, `settings-jobs`.
Their consumption IDs (`data-domains`, `business-roles`, …, `tags`, `jobs`) now gate
both the Settings sidebar entry and any cross-app consumption — the access level
expresses scope (READ_WRITE = use in app, ADMIN = manage the settings page).
- Remove `self-service` (only gated one endpoint). The deploy-approval handler in
`data_contracts_routes.py` now uses `data-contracts: READ/WRITE`.
- Remove the dead `llm-search` permission (LLM Search routes intentionally bypass
PermissionChecker and rely on per-tool filtering).
- Rename `settings-delivery` display name to "Delivery Modes" to disambiguate from
the `delivery-methods` reference data.
- Fix `settings-maturity-levels` display name (drop stale "Settings — " prefix).
- Add `hidden_from_role_dialog: True` to `notifications` and `entity_subscriptions`
(backend-only perms with no end-user UI).
- Add `cross_cutting: True` flag for features without a sidebar entry: `comments`,
`access-grants`, `process-workflows`, `business-owners`, `ontology`,
`entity_relationships`, `schema-importer`.
- Drop `None` from the allowed levels for implicit features that should be available
to any authenticated user: `comments`, `access-grants`, `process-workflows`. New
shared `IMPLICIT_FEATURE_LEVELS` constant (READ_ONLY → READ_WRITE → ADMIN).
Backend (routes):
- `tags_routes.py`: all 8 `PermissionChecker('settings-tags', …)` callsites switched
to `'tags'` (6 ADMIN, 2 READ_ONLY).
- `settings_routes.py`: `/settings/job-clusters` switched from `'settings-jobs'` to
`'jobs'`.
- `data_contracts_routes.py`: handle-deploy switched from `'self-service'` to
`'data-contracts'`.
Backend (settings_manager.py):
- `get_features_with_access_levels` now passes `hidden_from_role_dialog` and
`cross_cutting` flags through to the frontend.
Frontend:
- `settings-layout.tsx`: sidebar entries for Domains, Business Roles, Delivery
Methods, Teams, Projects, Audit, Tags, Jobs gate on their new consolidated IDs.
- `role-form-dialog.tsx`:
- Settings sub-groups (Reference Data, Configuration, Integrations, Operations,
Access Control) mirror the Settings sidebar order exactly. Reference Data now
sorts Asset Types between Delivery Methods and Teams to match the sidebar.
- Each non-Settings group splits into two sub-sections: sidebar items (sorted
by main-nav order) and a "Background" sub-section (alphabetical) for
cross-cutting features that don't have a sidebar entry.
- `business-owners` moved out of Settings → Reference Data into Settings →
Background (it has no sidebar entry — used inline by the ownership panel).
- Hidden features (`hidden_from_role_dialog`) are skipped entirely.
- Settings — Maturity Levels appears with its corrected display name.
- View `permissionId` props point at the consolidated consumption IDs:
audit-trail, business-roles, data-domains, delivery-methods, projects, teams,
settings-jobs, settings-tags.
- `types/settings.ts`: `FeatureConfig` gains optional `hidden_from_role_dialog`
and `cross_cutting` fields.
- `settings.json`: new `permissions.crossCutting` translation key ("Background");
removed unused `settingsSubGroups.tags` / `.jobs` entries.
Tests:
- `test_settings_manager.py::test_get_features_with_access_levels` expected
subpage IDs updated to reflect the consolidation; `settings-maturity-levels`
added to the expected set.
Migration note: existing roles in the DB with `comments: None` (or other
implicit-feature `None` values) will keep that value until next edit, since the
runtime PermissionChecker is unchanged — only the dropdown options are
restricted going forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidates the duplicate
settings-*permissions with their consumption-side counterparts and reshapes the role editor to mirror the actual sidebar layout instead of an arbitrary flat list. Also clarifies the dropdown semantics for "implicit" features (commenting, requesting access grants, viewing process workflows) soNoneis no longer offered as a choice for features every authenticated user should have access to.Permission consolidation
Eight
settings-*permissions are removed; their consumption-side IDs now gate both the Settings sidebar entry and any cross-app surface. The access level expresses scope (READ_WRITE= use in app,ADMIN= manage the settings page):settings-data-domainsdata-domainssettings-business-rolesbusiness-rolessettings-delivery-methodsdelivery-methodssettings-teamsteamssettings-projectsprojectssettings-auditauditsettings-tagstagssettings-jobsjobsAlso removed:
self-service(only gatedPOST /data-contracts/{id}/handle-deploy, now usesdata-contracts: READ/WRITEsince approving a deploy is a modify-contract action).llm-search(dead permission — LLM Search routes intentionally bypassPermissionCheckerand rely on per-tool result filtering).Implicit feature levels
Three features that should be available to any authenticated user no longer offer
Nonein the dropdown — new sharedIMPLICIT_FEATURE_LEVELS = [READ_ONLY, READ_WRITE, ADMIN]:comments(Comments & Ratings)access-grantsprocess-workflowsRole editor restructuring
role-form-dialog.tsxnow mirrors the actual sidebar layout:comments,access-grants,process-workflows,business-owners,ontology,entity_relationships,schema-importer.hidden_from_role_dialog) are skipped entirely (notifications,entity_subscriptions).settings-deliveryrenamed to "Delivery Modes" to disambiguate from thedelivery-methodsreference data.settings-maturity-levelsdisplay name fixed (stale "Settings — " prefix removed).Backend flags surfaced through API
get_features_with_access_levelsnow passes two flags to the frontend:hidden_from_role_dialog: True— backend-only perms with no end-user UI surface.cross_cutting: True— features rendered inline (panels, detail pages) without a sidebar entry.Files changed
features.py,settings_manager.py,data_contracts_routes.py,settings_routes.py,tags_routes.py,test_settings_manager.pyrole-form-dialog.tsx,settings-layout.tsx,types/settings.ts,settings.json, views (audit-trail,business-roles,data-domains,delivery-methods,projects,teams,settings-jobs,settings-tags)18 files changed, 431 insertions(+), 184 deletions(-).
Migration note
Existing roles in the DB with
comments: None(or other implicit-featureNonevalues) keep that value until the role is next edited — the runtimePermissionCheckeris unchanged, only the dropdown options are restricted going forward.Test plan
test_settings_manager.py::test_get_features_with_access_levelsupdated and passing — expected subpage IDs reflect the consolidation;settings-maturity-levelsadded to the expected set.comments,access-grants,process-workflowsdropdowns no longer offerNonenotificationsandentity_subscriptionsdo not appear at alltagspermission, confirm Tags settings page is gated correctly (R/O hides admin actions, ADMIN shows them) and tag application still works on detail pages at R/W.