feat(core): dynamic menu providers and runtime permission sources (#340, #334) - #407
Open
antosubash wants to merge 2 commits into
Open
antosubash wants to merge 2 commits into
antosubash wants to merge 2 commits into
Conversation
MenuRegistry.add_provider / remove; PermissionRegistry.add_source / invalidate_source, surfaced in all_permissions, groups and the role editor. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
d288750
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f3960f28.simple-module-python.pages.dev |
| Branch Preview URL: | https://feat-340-334-runtime-menus-a.simple-module-python.pages.dev |
This branch has not been deployed
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.
Fixes #340
Fixes #334
Design
Menu providers (#340).
MenuRegistry.add_provider(fn)takesfn(request)returning an iterable ofMenuItem; sync or async.InertiaLayoutDataMiddlewarenow calls the new asyncget_for_request, which collects provider items per request (after auth andrequest.state.tenant_idare resolved) and passes them to the unchangedget_for_userasextra_items, so role/permission filtering, translation, ordering and grouping are shared with static items. The static sorted cache is untouched. A provider that raises is logged and contributes nothing.MenuRegistry.remove(predicate)drops static items and invalidates the cache.Permission sources (#334).
PermissionRegistry.add_source(name, provider)with a sync provider returning keys or(key, label)pairs; output is cached per source and refreshed byinvalidate_source(name).all_permissions,groups,hasand thereforerole_mapwildcard expansion, admin's implicit all-permissions, the role editor and bothRequiresPermissionvariants see source permissions, with no changes needed outside the registry. Source permissions are persisted like any key. A failing source is logged and contributes nothing. The role editor API gains an additivePermissionGroupOut.labels.Additive only, to limit conflicts with #398 / #404.
Not done: label translation keys for source permissions (labels are literal;
t()needs literal keys in TSX), and no frontend rendering oflabelsyet.https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4