mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-22 00:07:52 +01:00
Fix:Get library check user access
This commit is contained in:
parent
8442a629fb
commit
156a4ed01d
@ -38,6 +38,12 @@ class LibraryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findOne(req, res) {
|
async findOne(req, res) {
|
||||||
|
var librariesAccessible = req.user.librariesAccessible || []
|
||||||
|
if (librariesAccessible && librariesAccessible.length && !librariesAccessible.includes(req.library.id)) {
|
||||||
|
Logger.warn(`[LibraryController] Library ${req.library.id} not accessible to user ${req.user.username}`)
|
||||||
|
return res.sendStatus(404)
|
||||||
|
}
|
||||||
|
|
||||||
if (req.query.include && req.query.include === 'filterdata') {
|
if (req.query.include && req.query.include === 'filterdata') {
|
||||||
var books = this.db.audiobooks.filter(ab => ab.libraryId === req.library.id)
|
var books = this.db.audiobooks.filter(ab => ab.libraryId === req.library.id)
|
||||||
return res.json({
|
return res.json({
|
||||||
|
Loading…
Reference in New Issue
Block a user