mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-13 12:23:34 +01:00
Update author middleware check user can access library
This commit is contained in:
1 parent
a06639886b
commit
3b4895b1b0
1 file changed
+1
@@ -427,6 +427,7 @@ class AuthorController {
|
|||||||
async middleware(req, res, next) {
|
async middleware(req, res, next) {
|
||||||
const author = await Database.authorModel.findByPk(req.params.id)
|
const author = await Database.authorModel.findByPk(req.params.id)
|
||||||
if (!author) return res.sendStatus(404)
|
if (!author) return res.sendStatus(404)
|
||||||
|
if (!req.user.checkCanAccessLibrary(author.libraryId)) return res.sendStatus(404)
|
||||||
|
|
||||||
if (req.method == 'DELETE' && !req.user.canDelete) {
|
if (req.method == 'DELETE' && !req.user.canDelete) {
|
||||||
Logger.warn(`[AuthorController] User "${req.user.username}" attempted to delete without permission`)
|
Logger.warn(`[AuthorController] User "${req.user.username}" attempted to delete without permission`)
|
||||||
|
|||||||
Reference in new issue
Block a user