Skip to content

Listed the server's users through GetUsers() on Jellyfin 12.2 - #365

Merged
RadicalMuffinMan merged 1 commit into
Moonfin-Client:masterfrom
benklop:fix/user-directory-jellyfin-12
Nov 5, 2026
Merged

RadicalMuffinMan merged 1 commit into
Moonfin-Client:masterfrom
benklop:fix/user-directory-jellyfin-12

Conversation

@benklop

@benklop benklop commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

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}/Pin answers 404 "That user does not exist" for a real user.

UserDirectory reads IUserManager.Users by reflection. Jellyfin 12.2 removed that property in favour of a GetUsers() method, so the binding came back null and the directory returned an empty list without logging anything. This lists users through GetUsers() when the server has it and the Users property otherwise, the same order MoonfinController already uses for user ids.

Related Issues

Type of Change

  • Bug fix

Area

  • Admin defaults / config page
  • Other / shared

Changes Made

  • Helpers/UserReflection.cs: AllUsers(services) and UserListBinding(managerType), which picks GetUsers() when the user manager has it (12.2+) and the Users property 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 no GetUserDto, 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.10 IUserManager the tests build against.

Client Impact

  • No client changes needed

Compatibility

  • Older clients still work, unknown fields are ignored and no keys were removed

No settings or response shapes change.

Testing

  • Built the plugin and deployed to a Jellyfin server
  • Manual testing completed

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/Pins answered [] and an admin PIN reset answered 404. After it:

  1. GET /Moonfin/Admin/Pins lists all 8 users, administrators first.
  2. PUT /Moonfin/Users/{id}/Pin with {"pin":"4821"} for a non-admin user: 200 {"enabled":true}, and the list then shows that user with a PIN.
  3. DELETE /Moonfin/Users/{id}/Pin: 200 {"enabled":false}, and the list shows the PIN gone.
  4. DELETE for an id that isn't a user still answers 404.
  5. The PINs section of the Moonbase config page lists all 8 users, each with Set PIN.

dotnet test of Moonfin.Server.Tests: 1053 passed.

Not tested on Jellyfin 10.10 or 10.11, only 12.2.0. On those the Users property is used as before; the unit tests cover that choice against the 10.10 IUserManager.

Test Steps

  1. Install the build on a Jellyfin 12.2 server.
  2. Open Dashboard → Plugins → Moonbase → Accounts → PINs: every user is listed.
  3. Set a PIN for a user there, then reset it: both succeed.

Screenshots (if applicable)

image

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

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

…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]>
@github-actions github-actions Bot added Bug Something isn't working Config Page labels Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 51630b6 and 07d0a14.

Files selected for processing: 3
  • Jellyfin/backend/Helpers/UserReflection.cs
  • Jellyfin/backend/Services/UserDirectory.cs
  • Jellyfin/tests/Moonfin.Server.Tests/UserListBindingTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved user listing compatibility across supported configurations, helping user directories display available accounts when the user list is exposed through different mechanisms.
    • When user listing is unavailable, the directory now returns an empty result instead of failing; relevant issues are logged once.
  • Tests

    • Added coverage for supported and unsupported user-listing configurations.

UserReflection now supports user managers that expose users through either GetUsers() or a Users property. UserDirectory uses this helper and returns an empty result when required listing support is unavailable.

Changes: User list compatibility

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 UserDirectory and its Users() contract, which this change updates to use UserReflection.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: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the main change: listing Jellyfin users through GetUsers() for Jellyfin 12.2.
Description check Passed 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 un…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

Share

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Build Successful

Both plugins compiled against .NET 8, and both test suites passed.

Property Value
Commit 07d0a14
Jellyfin ABI 10.10.0.0
Emby version 3.0.0.0
Workflow Build #594

@benklop
benklop marked this pull request as ready for review November 1, 2026 05:12
Copilot AI balanced review requested due to automatic review settings November 1, 2026 05:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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() over Users.
  • Updates UserDirectory to 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

benklop added a commit to benklop/Plugin that referenced this pull request Nov 1, 2026
…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]>
@RadicalMuffinMan RadicalMuffinMan linked an issue Nov 5, 2026 that may be closed by this pull request
@RadicalMuffinMan
RadicalMuffinMan merged commit 8051761 into Moonfin-Client:master Nov 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Config Page

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Plugin] admin token unable to list users

3 participants