|
@@ -123,14 +123,14 @@ export default class AdminGeneralSecurityContainer extends Container {
|
|
|
/**
|
|
/**
|
|
|
* Switch authentication
|
|
* Switch authentication
|
|
|
*/
|
|
*/
|
|
|
- async switchAuthentication(auth) {
|
|
|
|
|
- const isEnabled = !this.state[`is${auth}Enabled`];
|
|
|
|
|
|
|
+ async switchAuthentication(stateVariableName, authId) {
|
|
|
|
|
+ const isEnabled = !this.state[stateVariableName];
|
|
|
try {
|
|
try {
|
|
|
await this.appContainer.apiv3.put('/security-setting/authentication/enabled', {
|
|
await this.appContainer.apiv3.put('/security-setting/authentication/enabled', {
|
|
|
isEnabled,
|
|
isEnabled,
|
|
|
- auth,
|
|
|
|
|
|
|
+ authId,
|
|
|
});
|
|
});
|
|
|
- this.setState({ [`is${auth}Enabled`]: isEnabled });
|
|
|
|
|
|
|
+ this.setState({ [stateVariableName]: isEnabled });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
@@ -141,7 +141,7 @@ export default class AdminGeneralSecurityContainer extends Container {
|
|
|
* Switch local enabled
|
|
* Switch local enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsLocalEnabled() {
|
|
async switchIsLocalEnabled() {
|
|
|
- this.switchAuthentication('Local');
|
|
|
|
|
|
|
+ this.switchAuthentication('isLocalEnabled', 'local');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -177,49 +177,49 @@ export default class AdminGeneralSecurityContainer extends Container {
|
|
|
* Switch LDAP enabled
|
|
* Switch LDAP enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsLdapEnabled() {
|
|
async switchIsLdapEnabled() {
|
|
|
- this.switchAuthentication('Ldap');
|
|
|
|
|
|
|
+ this.switchAuthentication('isLdapEnabled', 'ldap');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch SAML enabled
|
|
* Switch SAML enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsSamlEnabled() {
|
|
async switchIsSamlEnabled() {
|
|
|
- this.switchAuthentication('Saml');
|
|
|
|
|
|
|
+ this.switchAuthentication('isSamlEnabled', 'saml');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch Oidc enabled
|
|
* Switch Oidc enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsOidcEnabled() {
|
|
async switchIsOidcEnabled() {
|
|
|
- this.switchAuthentication('Oidc');
|
|
|
|
|
|
|
+ this.switchAuthentication('isOidcEnabled', 'oidc');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch Basic enabled
|
|
* Switch Basic enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsBasicEnabled() {
|
|
async switchIsBasicEnabled() {
|
|
|
- this.switchAuthentication('Basic');
|
|
|
|
|
|
|
+ this.switchAuthentication('isBasicEnabled', 'basic');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch GoogleOAuth enabled
|
|
* Switch GoogleOAuth enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsGoogleOAuthEnabled() {
|
|
async switchIsGoogleOAuthEnabled() {
|
|
|
- this.switchAuthentication('Google');
|
|
|
|
|
|
|
+ this.switchAuthentication('isGoogleEnabled', 'google');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch GithubOAuth enabled
|
|
* Switch GithubOAuth enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsGithubOAuthEnabled() {
|
|
async switchIsGithubOAuthEnabled() {
|
|
|
- this.switchAuthentication('GitHub');
|
|
|
|
|
|
|
+ this.switchAuthentication('isGitHubEnabled', 'github');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Switch TwitterOAuth enabled
|
|
* Switch TwitterOAuth enabled
|
|
|
*/
|
|
*/
|
|
|
async switchIsTwitterOAuthEnabled() {
|
|
async switchIsTwitterOAuthEnabled() {
|
|
|
- this.switchAuthentication('Twitter');
|
|
|
|
|
|
|
+ this.switchAuthentication('isTwitterEnabled', 'twitter');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|