mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
fix(persistence): show all genres to admins without user_library rows (#6502)
This commit is contained in:
parent
2f85c631bf
commit
ebdf2dc693
@ -170,9 +170,9 @@ func (r *baseTagRepository) applyLibraryFiltering(ctx context.Context, sq Select
|
||||
// Add library_tag join
|
||||
sq = sq.LeftJoin("library_tag on library_tag.tag_id = tag.id")
|
||||
|
||||
// For authenticated users, also join with user_library to filter by accessible libraries
|
||||
// Non-admins only see tags from libraries they are assigned to
|
||||
user := loggedUser(ctx)
|
||||
if user.ID != invalidUserId {
|
||||
if user.ID != invalidUserId && !user.IsAdmin {
|
||||
sq = sq.Join("user_library on user_library.library_id = library_tag.library_id AND user_library.user_id = ?", user.ID)
|
||||
}
|
||||
|
||||
|
||||
@ -144,9 +144,10 @@ var _ = Describe("Tag Library Filtering", func() {
|
||||
}
|
||||
|
||||
Context("Admin User", func() {
|
||||
It("should see all tags regardless of library", func() {
|
||||
tags := readAllTags(&adminUser)
|
||||
Expect(tags).To(HaveLen(3))
|
||||
It("should see all tags even without user_library assignments", func() {
|
||||
unassignedAdmin := model.User{ID: "admin-without-libraries", IsAdmin: true}
|
||||
Expect(readAllTags(&unassignedAdmin)).To(HaveLen(3))
|
||||
Expect(countTags(&unassignedAdmin)).To(Equal(int64(3)))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user