Add:Restrict user permissions by tag

This commit is contained in:
advplyr 2022-03-20 06:29:08 -05:00
parent f8d0384155
commit 27f1bd90f9
6 changed files with 114 additions and 11 deletions

View file

@ -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()