mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-09 13:50:42 +02:00
added a route and a method to store sso configs to the ApiController
This commit is contained in:
parent
c98a8ee776
commit
89a7611c18
@ -162,6 +162,7 @@ class ApiController {
|
||||
this.router.delete('/authors/:id', this.deleteAuthor.bind(this))
|
||||
|
||||
this.router.patch('/serverSettings', this.updateServerSettings.bind(this))
|
||||
this.router.patch('/SSOSettings', this.updateSSOSettings.bind(this))
|
||||
|
||||
this.router.post('/authorize', this.authorize.bind(this))
|
||||
|
||||
@ -290,6 +291,27 @@ class ApiController {
|
||||
})
|
||||
}
|
||||
|
||||
async updateSSOSettings(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error('User other than root attempting to update sso settings', req.user)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
let SSOUpdate = req.body
|
||||
if (!SSOUpdate || !isObject(SSOUpdate)) {
|
||||
return res.status(500).send('Invalid settings update object')
|
||||
}
|
||||
|
||||
console.log("SSOUpdate", JSON.stringify(SSOUpdate))
|
||||
var madeUpdates = this.db.SSOSettings.update(SSOUpdate)
|
||||
if (madeUpdates) {
|
||||
await this.db.updateEntity('sso', this.db.SSOUpdate)
|
||||
}
|
||||
return res.json({
|
||||
success: true,
|
||||
SSOUpdate: this.db.SSOUpdate
|
||||
})
|
||||
}
|
||||
|
||||
async download(req, res) {
|
||||
if (!req.user.canDownload) {
|
||||
Logger.error('User attempting to download without permission', req.user)
|
||||
|
Loading…
Reference in New Issue
Block a user