1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-05 22:00:05 +00:00

fix: ldap issues

logic fixed for updating user created by external auth provider
remove internal from AuthProviderType
replace AUTH_MECHANISM with AUTH_PROVIDERS
This commit is contained in:
2022-10-03 21:24:10 +05:00
parent 042ed41189
commit 4d64420c45
6 changed files with 28 additions and 29 deletions

View File

@@ -299,14 +299,19 @@ const updateUser = async (
const user = await User.findOne(findBy)
if (
user?.authProvider !== AuthProviderType.Internal &&
(username !== user?.username || displayName !== user?.displayName)
) {
if (username && username !== user?.username && user?.authProvider) {
throw {
code: 405,
message:
'Can not update username and display name of user that is created by an external auth provider.'
'Can not update username of user that is created by an external auth provider.'
}
}
if (displayName && displayName !== user?.displayName && user?.authProvider) {
throw {
code: 405,
message:
'Can not update display name of user that is created by an external auth provider.'
}
}