melodee icon indicating copy to clipboard operation
melodee copied to clipboard

User Library ACL Ability

Open sphildreth opened this issue 10 months ago • 0 comments

** Description ** Support multiple libraries with user-specific (via user groups) access controls.

** Requirements **

  • Support multiple libraries with:

    • independent root paths (and/or inbound pipelines per library)
    • per-library scanning/indexing config
    • no RBAC setup everyone has access
  • Per-user ACL:

    • allow/deny libraries per user
    • be user group based; user is in group, library has group access limitation, user gets access
    • ensure API browsing/streaming respects library permissions (no IDOR)
    • search endpoints (artists/albums/songs)
    • “Get by ID” endpoints (album, artist, song)
    • Streaming endpoints (Subsonic stream, native stream, Jellyfin stream)
    • Playlist resolution (playlist contains tracks from libraries user may not have anymore)
    • “Random”, “recent”, “starred”, “favorites” queries
  • UI:

    • Admin can create/edit libraries and assign user access.
    • Users see only permitted libraries; optional “switch library” picker or unified view with filtering.
    • Unified view (default): user sees all allowed libraries merged.
    • Add optional library filter dropdown (so users can narrow).
    • Admin UI: library editor includes:
      • name, roots, scan settings
      • “Access: Everyone” vs “Restricted to groups”
      • group selector
  • Policy

    • If Library has no group restrictions, it is accessible to all authenticated users.
    • If Library has one or more allowed groups, user must be a member of at least one allowed group.
    • Unauthorized item access returns 404 (avoid enumeration); browsing endpoints filter unauthorized content.

** Acceptance tests **

  1. Create Library A + Library B.
  2. Create two user groups, "user group a" and "user group b". Put User1 in "user group a", put User2 in "user group b"
  3. Assign groups to Library access restrictions, "user group a" to "Library A" and "user group b" to "Library B"
  4. User1 has access to A only; User2 to B only.
  5. User1 cannot browse/stream B content via UI or API (returns 403/404).
  6. Subsonic/OpenSubsonic clients attached to User1 cannot discover B.
  7. Remove User1 from “user group a” → User1 loses access to Library A immediately
  8. Ensure playlists don’t leak tracks after access removal (either hide entries or mark unavailable).

sphildreth avatar Jan 10 '26 20:01 sphildreth