mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Add:Restrict user permissions by tag
This commit is contained in:
parent
f8d0384155
commit
27f1bd90f9
6 changed files with 114 additions and 11 deletions
|
@ -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()
|
Loading…
Add table
Add a link
Reference in a new issue