test sync delete user
This commit is contained in:
parent
308fdef2f8
commit
84ebac00a9
@ -20,6 +20,8 @@ Namespace SyncUsers
|
||||
Public Function SyncUsers(GroupName As String, Users As List(Of ADUser), PropertyMapping As List(Of AttributeMapping)) As List(Of ADUser) Implements ISyncUsers.SyncUsers
|
||||
Dim oGroupId As Integer
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oSyncedUserIds As New List(Of Int64)
|
||||
|
||||
Dim oCreatedUsers As New List(Of ADUser)
|
||||
Dim oUpdatedUsers As New List(Of ADUser)
|
||||
|
||||
@ -40,7 +42,7 @@ Namespace SyncUsers
|
||||
|
||||
For Each oUser In Users
|
||||
Dim oUserId As Int64
|
||||
Dim oUserExists As Boolean = False
|
||||
Dim oUserExists As Boolean
|
||||
|
||||
' Check if user already exists
|
||||
Try
|
||||
@ -54,6 +56,11 @@ Namespace SyncUsers
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' Collect user ids from existing users
|
||||
If oUserExists Then
|
||||
oSyncedUserIds.Add(oUserId)
|
||||
End If
|
||||
|
||||
' Create or update user
|
||||
Try
|
||||
If Not oUserExists Then
|
||||
@ -99,6 +106,11 @@ Namespace SyncUsers
|
||||
oSyncedUsers.Add(oUser)
|
||||
Next
|
||||
|
||||
Dim oUserIdString = String.Join(",", oSyncedUserIds)
|
||||
Dim oSQL As String = $"SELECT COUNT(*) FROM TBDD_GROUPS_USER WHERE USER_ID NOT IN (${oUserIdString}) AND GROUP_ID = {oGroupId}"
|
||||
Dim oDeletedRelations = _mssql.GetScalarValue(oSQL)
|
||||
|
||||
_logger.Info("Deleted [{0}] user to group relations [TEST RUN]", oDeletedRelations)
|
||||
_logger.Info("Created [{0}] new users", oCreatedUsers.Count)
|
||||
_logger.Info("Updated [{0}] users", oUpdatedUsers.Count)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user