mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-27 22:29:38 +00:00
Fix user permissions restricted by tag #421
This commit is contained in:
parent
6f7d2ef4cd
commit
2276228531
4 changed files with 15 additions and 7 deletions
|
|
@ -253,7 +253,13 @@ class LibraryController {
|
|||
minified: req.query.minified === '1'
|
||||
}
|
||||
|
||||
var collections = this.db.collections.filter(c => c.libraryId === req.library.id).map(c => c.toJSONExpanded(libraryItems, payload.minified))
|
||||
var collections = this.db.collections.filter(c => c.libraryId === req.library.id).map(c => {
|
||||
var expanded = c.toJSONExpanded(libraryItems, payload.minified)
|
||||
// If all books restricted to user in this collection then hide this collection
|
||||
if (!expanded.books.length && c.books.length) return null
|
||||
return expanded
|
||||
}).filter(c => !!c)
|
||||
|
||||
payload.total = collections.length
|
||||
|
||||
if (payload.limit) {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,8 @@ class User {
|
|||
}
|
||||
|
||||
checkCanAccessLibraryItemWithTags(tags) {
|
||||
if (this.permissions.accessAllTags || !tags || !tags.length) return true
|
||||
if (!tags || !tags.length) return false
|
||||
if (this.permissions.accessAllTags) return true
|
||||
return this.itemTagsAccessible.some(tag => tags.includes(tag))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue