Repository navigation
Listed the server's users through GetUsers() on Jellyfin 12.2 - #365
RadicalMuffinMan merged 1 commit into
Conversation
…dropped the Users property. UserDirectory bound only IUserManager.Users. Jellyfin 12.2 removed that property in favour of GetUsers(), so the binding came back null and the directory quietly returned no users. On 12.2 that left the admin PIN list empty and made resetting a user's PIN answer 404 "That user does not exist", so an administrator could not clear a forgotten PIN. The list is now bound once in UserReflection.UserListBinding: GetUsers() when the user manager has it (12.2+), else the Users property (10.10 and 10.11), the same order MoonfinController already uses for user ids. When neither exists, or GetUserDto is missing, UserDirectory logs a warning once instead of returning an empty list without a word. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
User-list reflection binding Jellyfin/backend/Helpers/UserReflection.cs, Jellyfin/tests/Moonfin.Server.Tests/UserListBindingTests.cs |
UserReflection prefers an enumerable GetUsers() method, then an enumerable Users property. Tests cover both patterns, selection priority, unsupported types, and the test build’s IUserManager. |
Directory retrieval and warnings Jellyfin/backend/Services/UserDirectory.cs |
UserDirectory retrieves users through UserReflection.AllUsers. It returns an empty result when the manager or listing mechanism is unavailable, and logs the new warning once per process. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Possibly related PRs
- Moonfin-Client/Plugin#334: Introduced
UserDirectoryand itsUsers()contract, which this change updates to useUserReflection.AllUsers.
Suggested reviewers: radicalmuffinman
Merge Risk: 
Minimal · up to 07d0a
-
The change supports both user-list APIs. No merge-blocking issue is established.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description follows the repository template and explains the bug, compatibility approach, testing, client impact, and affected areas. It also records the Jellyfin 12.2.0 manual test results and unit-test results.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Build SuccessfulBoth plugins compiled against .NET 8, and both test suites passed.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the user-list compatibility change.
No open issues 🎉
What changed in this PR
Restores user listing for server-side PIN administration on Jellyfin 12.2 while preserving the older Users property fallback. No settings or response shapes change.
Changes:
- Adds reflection-based user enumeration that prefers
GetUsers()overUsers. - Updates
UserDirectoryto use the shared binding and warn once when required APIs are unavailable. - Adds tests for method, property, precedence, missing-binding, and Jellyfin 10.10 interface cases.
| File | Description |
|---|---|
Jellyfin/tests/Moonfin.Server.Tests/UserListBindingTests.cs |
Tests user-list binding selection and compatibility. |
Jellyfin/backend/Services/UserDirectory.cs |
Uses shared enumeration and adds one-time warnings. |
Jellyfin/backend/Helpers/UserReflection.cs |
Adds AllUsers and method-first user-list binding. |
Review effort: Balanced
…without being administrators An administrator groups accounts into households under Accounts. A household's managers can then, for everyone in it (other managers included): - add them all to the manager's own device at once (POST Moonfin/Household/Sessions, Jellyfin 12.0+, which keeps a session and token per user on a device; refused with unsupported_server before that), - approve a Quick Connect code for one of them on another device, - set or remove their PIN without the current one, - read and replace their access schedule. GET Moonfin/Household lists who the caller manages, with PIN, disabled, schedule and allowed-now/next-allowed state, and answers non-managers with empty lists so a client can decide whether to offer household setup at sign-in. Ping advertises householdSupported and householdSessionsSupported. Administrators can never be in a household or be reached: saves drop them and every call re-checks the server's users. A manager can sign in as a co-manager, so reach follows co-managers into their other households; the config page shows each manager's reach. Sessions are only minted for the caller's own device from their token's claims, disabled accounts and remote-blocked accounts are refused, and sign-ins are rate limited per manager. AccessSchedules are read and written by reflection because their entity type moved assemblies in 10.11. Builds on Moonfin-Client#365 (UserDirectory on 12.2) and Moonfin-Client#364 (Moonfin/Time), merged in here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pull Request
Summary
On Jellyfin 12.2 the plugin can't list the server's users, so the PINs section of the config page is empty and an administrator can't reset anyone's PIN:
DELETE /Moonfin/Users/{id}/Pinanswers 404 "That user does not exist" for a real user.UserDirectoryreadsIUserManager.Usersby reflection. Jellyfin 12.2 removed that property in favour of aGetUsers()method, so the binding came back null and the directory returned an empty list without logging anything. This lists users throughGetUsers()when the server has it and theUsersproperty otherwise, the same orderMoonfinControlleralready uses for user ids.Related Issues
Type of Change
Area
Changes Made
Helpers/UserReflection.cs:AllUsers(services)andUserListBinding(managerType), which picksGetUsers()when the user manager has it (12.2+) and theUsersproperty otherwise (10.10, 10.11), or nothing when it has neither.Services/UserDirectory.cs: lists users through that, and logs a warning once when the server offers no way to list users or noGetUserDto, instead of returning an empty list silently.UserListBindingTests: the property shape, the method shape, a manager with both (method wins), one with neither, and the 10.10IUserManagerthe tests build against.Client Impact
Compatibility
No settings or response shapes change.
Testing
Built from this branch on its own and installed on a Jellyfin 12.2.0 server with 8 users. Before the change,
GET /Moonfin/Admin/Pinsanswered[]and an admin PIN reset answered 404. After it:GET /Moonfin/Admin/Pinslists all 8 users, administrators first.PUT /Moonfin/Users/{id}/Pinwith{"pin":"4821"}for a non-admin user: 200{"enabled":true}, and the list then shows that user with a PIN.DELETE /Moonfin/Users/{id}/Pin: 200{"enabled":false}, and the list shows the PIN gone.DELETEfor an id that isn't a user still answers 404.dotnet testofMoonfin.Server.Tests: 1053 passed.Not tested on Jellyfin 10.10 or 10.11, only 12.2.0. On those the
Usersproperty is used as before; the unit tests cover that choice against the 10.10IUserManager.Test Steps
Screenshots (if applicable)
Checklist
AI assistance
An AI assistant (Claude) found the cause, wrote this change and helped test it, as the contributing guide asks me to say.
🤖 Generated with Claude Code