Add an admin backend for instance settings and author management - #112
Draft
ricardoboss wants to merge 5 commits into
Draft
Add an admin backend for instance settings and author management#112ricardoboss wants to merge 5 commits into
ricardoboss wants to merge 5 commits into
Conversation
Adds a settings layer on top of the `Setting` table the first-time setup introduced: a configuration provider registered last, so stored values take precedence over `appsettings.json` and the environment, and `IOptionsMonitor` consumers pick up a change without a restart and without changes of their own. Only keys declared in the settings registry are ever read from or written to the database. Deployment configuration such as connection strings, JWT keys and allowed origins therefore stays out of reach of the write path the admin backend is about to expose. `OpenRegistration` and `HostedUpstream:BaseUrl` are declared, which is what makes the note in the README about changing the former at runtime true for the first time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Lets admins change the instance settings and promote or demote authors through `/admin`. Changing settings goes through the same service the settings layer already exposes, so the registry and the value checks are shared rather than duplicated. Admins may now also discontinue, retract and delete packages they do not own. The four owner checks became one predicate, which is the only place that has to know admins are exempt. The last remaining admin can no longer be demoted or delete their account, for the same reason the first-time setup cannot be repeated: an instance without admins could never be administered again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds `/admin`, reachable from the navigation bar for admins, with a tab for the instance settings and one listing the authors with their roles. The settings tab renders whatever the API declares, so a new setting shows up without frontend changes. The package admin toolbar is now shown to admins on packages they do not own, matching what the API accepts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The note about changing `OpenRegistration` at runtime only ever worked by editing the mounted configuration file, and is now accurate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The setting descriptions rendered twice - as placeholder and as help - and the help landed beside the input instead of under it, because sibling children of a horizontal field-body become columns in Bulma. One inner field per row keeps the input full-width with its description below, once. The save button now starts at the input column like the other forms, and the authors table centers its cells vertically instead of letting the text hug the top edge of rows the buttons made taller. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #25.
What changed
Settingtable (registered last, so stored values take precedence overappsettings.jsonand the environment). Consumers pick up changes throughIOptionsMonitorwithout a restart. Only keys declared in the settings registry are readable/writable — currentlyOpenRegistrationandHostedUpstream:BaseUrl— so deployment configuration (connection strings,Jwt:*,AllowedOrigins) stays out of reach of the write path./adminAPI endpoints (admin-only policy): list/change settings, list authors with roles, promote/demote authors. The last remaining admin can neither be demoted nor delete their account, since onboarding cannot be repeated. Admins may also discontinue, retract and delete packages they do not own (author.CanManage(package)).IAdminServiceplus anIsAdminAsyncextension (fails closed, likeIsSelfAsync), with typed exceptions for the new error responses; Kiota client regenerated./adminpage with a settings tab (renders whatever descriptors the API declares, so new settings need no frontend change) and an authors tab, reachable from the nav bar for admins only. The package admin toolbar now also shows for admins on packages they do not own.Notes for reviewers
RoleandSettingKindnow serialize as camelCase strings (JsonStringEnumConverter). Previously they were bare integers in the OpenAPI document, which Kiota could not represent as enums. These are the only enums in the contract and both are consumed only by the frontend, sodart pubclients are unaffected.unknown-setting, 491invalid-setting-value.Settingtable from the first-time setup is reused. Stored settings are loaded right after migrations run at startup.🤖 Generated with Claude Code