mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-08 23:04:51 +02:00
Add:Restrict user permissions by tag
This commit is contained in:
@ -170,5 +170,21 @@ class MiscController {
|
||||
}
|
||||
res.json({ user: req.user })
|
||||
}
|
||||
|
||||
getAllTags(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error(`[MiscController] Non-root user attempted to getAllTags`)
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
var tags = []
|
||||
this.db.libraryItems.forEach((li) => {
|
||||
if (li.media.tags && li.media.tags.length) {
|
||||
li.media.tags.forEach((tag) => {
|
||||
if (!tags.includes(tag)) tags.push(tag)
|
||||
})
|
||||
}
|
||||
})
|
||||
res.json(tags)
|
||||
}
|
||||
}
|
||||
module.exports = new MiscController()
|
Reference in New Issue
Block a user