mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-09-06 17:51:08 +02:00
added a SSOSettings class
This commit is contained in:
parent
53e6c9f913
commit
dbf09ad451
68
server/objects/SSOSettings.js
Normal file
68
server/objects/SSOSettings.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
const { CoverDestination, BookCoverAspectRatio, BookshelfView } = require('../utils/constants')
|
||||||
|
const Logger = require('../Logger')
|
||||||
|
const User = require('./User')
|
||||||
|
|
||||||
|
const defaultSettings = {
|
||||||
|
oidc: {
|
||||||
|
issuer: "",
|
||||||
|
authorizationURL: "",
|
||||||
|
tokenURL: "",
|
||||||
|
userInfoURL: "",
|
||||||
|
clientID: "",
|
||||||
|
clientSecret: "",
|
||||||
|
callbackURL: "/oidc/callback",
|
||||||
|
scope: "openid email profile"
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
createNewUser: false,
|
||||||
|
isActive: true,
|
||||||
|
userSettings: {
|
||||||
|
mobileOrderBy: 'recent',
|
||||||
|
mobileOrderDesc: true,
|
||||||
|
mobileFilterBy: 'all',
|
||||||
|
orderBy: 'book.title',
|
||||||
|
orderDesc: false,
|
||||||
|
filterBy: 'all',
|
||||||
|
playbackRate: 1,
|
||||||
|
bookshelfCoverSize: 120,
|
||||||
|
collapseSeries: false
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
download: false,
|
||||||
|
update: false,
|
||||||
|
delete: false,
|
||||||
|
upload: false,
|
||||||
|
accessAllLibraries: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SSOSettings {
|
||||||
|
constructor(settings=defaultSettings) {
|
||||||
|
this.id = 'sso-settings'
|
||||||
|
this.oidc = {...settings.oidc}
|
||||||
|
this.user = {...settings.user}
|
||||||
|
}
|
||||||
|
|
||||||
|
toJSON() {
|
||||||
|
return {
|
||||||
|
oidc: {...this.oidc},
|
||||||
|
user: {...this.user}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update(payload) {
|
||||||
|
let hasUpdates = false
|
||||||
|
for (const key in payload) {
|
||||||
|
for (const setting in payload) {
|
||||||
|
if (!this[key] || this[key][setting] === payload[key][setting]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
this[key][setting] = payload[key][setting]
|
||||||
|
hasUpdates = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasUpdates
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = SSOSettings
|
Loading…
Reference in New Issue
Block a user