Fix:Get library check user access

This commit is contained in:
advplyr 2022-01-16 13:37:32 -06:00
parent 8442a629fb
commit 156a4ed01d

View File

@ -38,6 +38,12 @@ class LibraryController {
}
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') {
var books = this.db.audiobooks.filter(ab => ab.libraryId === req.library.id)
return res.json({