Repository navigation
fix(profiles): let regular accounts manage household profiles - #595
Conversation
The phone and TV pickers showed Manage and the Add profile tile only to admin accounts. Since silo-server#2019 the server lets the account's verified primary profile manage the household whatever the role, and Manage already acts as the primary (#493), so the role check left regular households with no way to add, edit or delete a profile. Show both whenever the household has a primary profile. The manage gate tests become ManageGate tests covering a regular account, a failed account lookup and a household without a primary. Closes #592 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Problem
Closes #592
Related issue: Silo-Server/silo-server#1179
Validation tasks: changes #332 C1; changes #333 C1
On an account that isn't a server admin, the phone and TV profile pickers show no Manage button and no Add tile. The picker is the only way into the create and edit screens, so a regular household can't add, edit or delete a profile from Android at all.
Both pickers decided this from the account role (
role == "admin"), a gate from #263, when only admin accounts could manage without a selected profile. Since Silo-Server/silo-server#2019, the server lets the account's primary profile manage the household, verified with its PIN, whatever the role. #493 already made Manage act as the primary profile but kept the admin check.Approach
The pickers now show Manage and the Add tile whenever the household has a primary profile, using the same
householdPrimary()lookup that entering manage mode already uses. The account role no longer matters. Everything after that is unchanged: the primary's PIN is asked for when it has one, its proof is held only while managing, the device's selected profile stays as it was, and server refusals show their message.ProfileSelectionAdminGateTestandTvProfileSelectionAdminGateTestbecomeProfileSelectionManageGateTestandTvProfileSelectionManageGateTest, with three cases each: a regular account's household with a primary can manage and enter manage mode, a failed account lookup doesn't hide management, and a household with no primary can't manage, even on an admin account.Decisions for review
householdPrimary()is the profile marked primary, or the only profile when there is just one. The server marks one primary on every account that has profiles (migration 094 and a unique index). A household with no profiles shows neither Manage nor Add. Before, an admin saw the Add tile there, but tapping it only raised "Couldn't find the primary profile needed to manage profiles." The Apple apps show the Add tile on every account and raise the same error on tap. The issue asked for "every account that has a primary profile", so I hid it instead of copying Apple.Validation
main(685344a9f), using a synthetic regular (role: user) account whose only profile is a primary with a PIN. Before (main,b5bf8599), the phone and TV pickers show the profile, Change server and Sign out only.verifyProfilePIN200,createProfile201,updateProfile200 anddeleteProfile204 for each walk. The primary profile has no Delete button.main's view models, each for the intended reason../gradlew testDebugUnitTest: pass. Lint (:android-shared:lintDebug :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:lintVitalRelease :androidTvApp:lintVitalRelease): no new issues against the baseline.:androidApp:assembleDebugand:androidTvApp:assembleDebugpass. The two supply-chain scripts couldn't run locally because the build host has noruby. This diff touches no build or workflow files, and CI runs them.Evidence: https://evidence.siloserver.org/r/silo-android/issue-592/
Risks
Follow-ups
getCurrentUser) before listing profiles. It now only fills "Signed in as", so the two calls could run in parallel. Not changed here.Checklist
AI Disclosure
🤖 Generated with Claude Code