Summary
User in AD has different email from what is in TV, the email in TV is an alias (previous main email) of the user.
This especially becomes an issue with SSO login, where TV says the account doesn't exist.
Expected Behavior
The changed email in AD should be updated in TV
Steps To Reproduce
- Sync user from AD to TV
- Change email in AD
- Sync
- Email in TV was not updated and is still the old value
Fix
index 2c0342a..22807f7 100644
--- a/TeamViewerADConnector/Internal/Sync.ps1
+++ b/TeamViewerADConnector/Internal/Sync.ps1
@@ -41,6 +41,9 @@ function ConvertTo-SyncUpdateUserChangeset($userTV, $userAD) {
if ($userAD.name -ne $userTV.name) {
$changeset.name = $userAD.name
}
+ if ($userAD.email -ne $userTV.email) {
+ $changeset.email = $userAD.email
+ }
if ($userAD.IsEnabled -ne $userTV.active) {
$changeset.active = $userAD.IsEnabled
}
@@ -57,6 +60,9 @@ function Format-SyncUpdateUserChangeset {
if ($changeset.name) {
$message += "Changing name to '$($changeset.name)'. "
}
+ if ($changeset.email) {
+ $message += "Changing email to '$($changeset.email)'. "
+ }
if ($changeset.active) {
$message += "Changing account status to 'active'. "
}
@@ -181,7 +181,7 @@ function Invoke-SyncUser($syncContext, $configuration, $progressHandler) {
ForEach ($userAd in $syncContext.UsersActiveDirectory) {
$userTv = $userAd | Resolve-TeamViewerAccount $syncContext $configuration
- if ($userTv -and $userTv.active -and $userTv.name -eq $userAd.name) {
+ if ($userTv -and $userTv.active -and $userTv.name -eq $userAd.name -and $userTv.email -eq $userAd.email) {
Write-SyncLog "No changes for user $($userAd.email). Skipping."
$statistics.NotChanged++
}
But even with this, the email doesn't change in TV, even tho the email is in the REST PUT request to update the user
Summary
User in AD has different email from what is in TV, the email in TV is an alias (previous main email) of the user.
This especially becomes an issue with SSO login, where TV says the account doesn't exist.
Expected Behavior
The changed email in AD should be updated in TV
Steps To Reproduce
Fix
But even with this, the email doesn't change in TV, even tho the email is in the REST PUT request to update the user