This commit is contained in:
David Leimroth 2022-02-10 14:56:27 +01:00
parent 3cd09eecba
commit b77f7f2514
2 changed files with 0 additions and 22 deletions

View File

@ -297,14 +297,12 @@ class ApiController {
return res.sendStatus(403)
}
let SSOUpdate = req.body
Logger.debug("SSOUpdate=", SSOUpdate)
if (!SSOUpdate || !isObject(SSOUpdate)) {
return res.status(500).send('Invalid settings update object')
}
var madeUpdates = this.db.SSOSettings.update(SSOUpdate)
console.log("SSOUpdate", JSON.stringify(this.db.SSOSettings))
if (madeUpdates) {
await this.db.updateEntity('settings', this.db.SSOSettings)
}

View File

@ -28,7 +28,6 @@ class SSOSettings {
this.id = 'sso-settings'
this.user = { ...settings.user }
this.initOIDCSettings(settings);
Logger.debug("[SSOSettings.constructor]", this.toJSON)
}
initOIDCSettings(settings) {
@ -75,31 +74,12 @@ class SSOSettings {
const oldTmp = JSON.stringify(this.toJSON())
const newTmp = JSON.stringify(payload) // deep copy "for free"
const hasUpdates = difference(oldTmp, newTmp) !== ""; // Not very efficient, but ok for small objects
Logger.debug(`SSOSettings hasUpdates=${hasUpdates}`)
if (!hasUpdates) return hasUpdates
payload = JSON.parse(newTmp)
this.oidc = payload.oidc
this.user = payload.user
return hasUpdates
Logger.debug("SSOSettings.update", payload, this)
for (const key in payload) {
Logger.debug(`key: ${key}: ${JSON.stringify(payload[key])}`)
if (isObject(payload[key])) {
for (const setting in payload[key]) {
if (!this[key] || this[key][setting] === payload[key][setting]) {
continue
}
this[key][setting] = payload[key][setting]
hasUpdates = true
}
} else if (this[key] !== undefined && this[key] !== payload[key]) {
this[key] = payload[key]
hasUpdates = true
}
}
Logger.debug("SSOSettings.update", hasUpdates, this)
return hasUpdates
}
getNewUserPermissions() {