Fix:Get libraries endpoint return only libraries accessible to user

This commit is contained in:
advplyr 2022-01-16 11:17:09 -06:00
parent 48921c3150
commit 8442a629fb

View File

@ -29,6 +29,11 @@ class LibraryController {
}
findAll(req, res) {
var librariesAccessible = req.user.librariesAccessible || []
if (librariesAccessible && librariesAccessible.length) {
return res.json(this.db.libraries.filter(lib => librariesAccessible.includes(lib.id)).map(lib => lib.toJSON()))
}
res.json(this.db.libraries.map(lib => lib.toJSON()))
}