fix(core): Persist CurrentAuthenticationMethod setting change (#5762)

* limit user invites when saml is enabled

* persist CurrentAuthenticationMethod
This commit is contained in:
Michael Auerswald
2023-03-23 15:13:05 +01:00
committed by GitHub
parent 57748b71e5
commit 4498c6013d
3 changed files with 12 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import config from '@/config';
import * as Db from '@/Db';
import type { AuthProviderType } from '@/databases/entities/AuthIdentity';
export function isSamlCurrentAuthenticationMethod(): boolean {
@@ -17,6 +18,12 @@ export function doRedirectUsersFromLoginToSsoFlow(): boolean {
return config.getEnv('sso.redirectLoginToSso');
}
export function setCurrentAuthenticationMethod(authenticationMethod: AuthProviderType): void {
export async function setCurrentAuthenticationMethod(
authenticationMethod: AuthProviderType,
): Promise<void> {
config.set('userManagement.authenticationMethod', authenticationMethod);
await Db.collections.Settings.save({
key: 'userManagement.authenticationMethod',
value: authenticationMethod,
});
}