-
Notifications
You must be signed in to change notification settings - Fork 10
fix(admin, tv): stop a household profile being labelled and treated as admin #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
RXWatcher
merged 5 commits into
Silo-Server:main
from
RXWatcher:fix/acting-admin-fail-closed
Aug 6, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4efc14e
fix(admin): stop a non-owner profile seeing the admin surface
RXWatcher 9eaeb4b
fix(tv): stop the profile menu labelling a household profile ADMIN
RXWatcher c5022db
fix(tv): show no account caption on a household profile
RXWatcher 2230e0f
fix(admin): let the destination gate recover from an unresolved profile
RXWatcher eaaa707
Merge branch 'main' into fix/acting-admin-fail-closed
RXWatcher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
37 changes: 37 additions & 0 deletions
37
...App/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/admin/AdminRouteGate.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package org.siloserver.silo.android.ui.screens.admin | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.collectAsState | ||
| import androidx.compose.runtime.getValue | ||
| import org.koin.compose.viewmodel.koinViewModel | ||
| import org.siloserver.silo.android.ui.components.LoadingIndicator | ||
|
|
||
| /** | ||
| * Re-evaluates the acting-admin gate at the DESTINATION, not just at the entry | ||
| * that offered it. | ||
| * | ||
| * Gating only the menu row is not enough: the route stays registered, so | ||
| * restored navigation, a back-stack replay, or any future deep link reaches the | ||
| * screen directly — and an admin screen calls its API as soon as it composes. | ||
| * A gate that can be walked around is a gate in name only. | ||
| * | ||
| * This does NOT make the client a security boundary; only the server can be | ||
| * that, and the client cannot prove what the server enforces. It closes the | ||
| * client-side hole so that being refused is the default rather than a | ||
| * consequence of having arrived by the expected path. | ||
| */ | ||
| @Composable | ||
| fun AdminRouteGate( | ||
| viewModel: AdminEntryViewModel = koinViewModel(), | ||
| content: @Composable () -> Unit, | ||
| ) { | ||
| val state by viewModel.uiState.collectAsState() | ||
| when { | ||
| // Nothing is shown while the gate is still resolving. Rendering the | ||
| // screen first and revoking it after would have already fired the | ||
| // admin API call this exists to prevent. | ||
| state.isLoading -> LoadingIndicator() | ||
| state.isAdminVisible -> content() | ||
| else -> NotAuthorized() | ||
| } | ||
| } | ||
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Retry unresolved profiles in the destination gate.
AdminRouteGateuses the defaultAdminEntryViewModel, whose production gate reads the active profile once. If that lookup returnsnull,refresh()completes and this route remains onNotAuthorized()for the lifetime of its back-stack entry.This breaks the recovery requirement documented by
isActingAdmin. A primary-profile owner who reaches a restored or direct route during a transient profile failure cannot regain access after the profile resolves.Add bounded profile retry or profile observation to
AdminEntryViewModel. Add a test where profile resolution changes from unresolved to primary while the destination remains active.🤖 Prompt for AI Agents