feat: admin auth - save config
This commit is contained in:
@@ -50,6 +50,27 @@ module.exports = {
|
||||
} catch (err) {
|
||||
return graphHelper.generateError(err)
|
||||
}
|
||||
},
|
||||
async updateStrategies(obj, args, context) {
|
||||
try {
|
||||
for (let str of args.strategies) {
|
||||
await WIKI.db.authentication.query().patch({
|
||||
isEnabled: str.isEnabled,
|
||||
config: _.reduce(str.config, (result, value, key) => {
|
||||
_.set(result, value.key, value.value)
|
||||
return result
|
||||
}, {}),
|
||||
selfRegistration: str.selfRegistration,
|
||||
domainWhitelist: { v: str.domainWhitelist },
|
||||
autoEnrollGroups: { v: str.autoEnrollGroups }
|
||||
}).where('key', str.key)
|
||||
}
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Strategies updated successfully')
|
||||
}
|
||||
} catch (err) {
|
||||
return graphHelper.generateError(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
AuthenticationStrategy: {
|
||||
|
@@ -37,10 +37,8 @@ type AuthenticationMutation {
|
||||
securityCode: String!
|
||||
): DefaultResponse
|
||||
|
||||
updateStrategy(
|
||||
strategy: String!
|
||||
isEnabled: Boolean!
|
||||
config: [KeyValuePairInput]
|
||||
updateStrategies(
|
||||
strategies: [AuthenticationStrategyInput]
|
||||
): DefaultResponse
|
||||
}
|
||||
|
||||
@@ -58,7 +56,7 @@ type AuthenticationStrategy {
|
||||
config: [KeyValuePair]
|
||||
selfRegistration: Boolean!
|
||||
domainWhitelist: [String]!
|
||||
autoEnrollGroups: [String]!
|
||||
autoEnrollGroups: [Int]!
|
||||
}
|
||||
|
||||
type AuthenticationLoginResponse {
|
||||
@@ -66,3 +64,12 @@ type AuthenticationLoginResponse {
|
||||
tfaRequired: Boolean
|
||||
tfaLoginToken: String
|
||||
}
|
||||
|
||||
input AuthenticationStrategyInput {
|
||||
isEnabled: Boolean!
|
||||
key: String!
|
||||
config: [KeyValuePairInput]
|
||||
selfRegistration: Boolean!
|
||||
domainWhitelist: [String]!
|
||||
autoEnrollGroups: [Int]!
|
||||
}
|
||||
|
Reference in New Issue
Block a user