fix bug in jobrunner, adsync
This commit is contained in:
@@ -8,9 +8,6 @@ Public Class ActiveDirectoryInterface
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
|
||||
Private ReadOnly _firebird As Firebird
|
||||
Private ReadOnly _mssql As MSSQLServer
|
||||
|
||||
Private ReadOnly _rootPath As String
|
||||
|
||||
Private _rootNode As DirectoryEntry
|
||||
@@ -54,8 +51,8 @@ Public Class ActiveDirectoryInterface
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oGroupId As Int64 = Nothing
|
||||
|
||||
Dim oFirebirdSync As New SyncUsers.SyncUsersFirebird(_logConfig, _firebird)
|
||||
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, _mssql)
|
||||
Dim oFirebirdSync As New SyncUsers.SyncUsersFirebird(_logConfig, Firebird)
|
||||
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, MSSQL)
|
||||
Dim oSyncedUsersFirebird, oSyncedUsersMSSQL As List(Of ADUser)
|
||||
|
||||
Try
|
||||
@@ -73,19 +70,23 @@ Public Class ActiveDirectoryInterface
|
||||
End If
|
||||
|
||||
' Do the actual sync into firebird
|
||||
If _firebird IsNot Nothing Then
|
||||
If Firebird IsNot Nothing Then
|
||||
oSyncedUsersFirebird = oFirebirdSync.SyncUsers(GroupName, oUsers, AttributeMappings)
|
||||
If oSyncedUsersFirebird.Count > 0 Then
|
||||
_logger.Info("Synced {0} users to Firebird", oSyncedUsersFirebird.Count)
|
||||
End If
|
||||
Else
|
||||
_logger.Debug("SyncUsersForGroup: _firebird is nothing. ")
|
||||
End If
|
||||
|
||||
' Do the actual sync into MSSQL
|
||||
If _mssql IsNot Nothing Then
|
||||
If MSSQL IsNot Nothing Then
|
||||
oSyncedUsersMSSQL = oSQLSync.SyncUsers(GroupName, oUsers, AttributeMappings)
|
||||
If oSyncedUsersMSSQL.Count > 0 Then
|
||||
_logger.Info("Synced {0} users to MSSQLServer", oSyncedUsersMSSQL.Count)
|
||||
End If
|
||||
Else
|
||||
_logger.Debug("SyncUsersForGroup: _mssql is nothing. ")
|
||||
End If
|
||||
|
||||
Return oUsers
|
||||
@@ -171,10 +172,10 @@ Public Class ActiveDirectoryInterface
|
||||
Dim oUserFound = FindUserWithFilter(oUserEx, Filter)
|
||||
|
||||
If oUserFound = False Then
|
||||
_logger.Debug("User '{0}' was skipped out due to user filter.", oUserEx.SamAccountName)
|
||||
_logger.Debug("User [{0}] was skipped out due to user filter.", oUserEx.SamAccountName)
|
||||
Continue For
|
||||
End If
|
||||
_logger.Debug("User '{0}' passed the filter.", oUserEx.SamAccountName)
|
||||
_logger.Debug("User [{0}] passed the filter.", oUserEx.SamAccountName)
|
||||
|
||||
' TODO: Figure out why oUserEx can be nothing for certain users
|
||||
If oUserEx IsNot Nothing Then
|
||||
@@ -182,7 +183,7 @@ Public Class ActiveDirectoryInterface
|
||||
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
|
||||
|
||||
If oAttributeValue <> String.Empty Then
|
||||
_logger.Debug("Attribute {0} is not empty.", oMap.AttributeName)
|
||||
_logger.Debug("Attribute [{0}] is not empty.", oMap.AttributeName)
|
||||
|
||||
oCustomAttributes.Add(New ADUser.CustomAttribute() With {
|
||||
.Name = oMap.AttributeName,
|
||||
@@ -193,10 +194,10 @@ Public Class ActiveDirectoryInterface
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
_logger.Debug("Could not fetch CustomAttributes for user {0}", oUser)
|
||||
_logger.Debug("Could not fetch CustomAttributes for user [{0}]", oUser)
|
||||
End If
|
||||
|
||||
_logger.Debug("Trying to add User {0} to user list", oUser)
|
||||
_logger.Debug("Trying to add User [{0}] to user list", oUser)
|
||||
|
||||
Dim oNewUser As New ADUser With {
|
||||
.SId = oUser.Sid,
|
||||
@@ -239,14 +240,14 @@ Public Class ActiveDirectoryInterface
|
||||
}
|
||||
|
||||
If Filter = String.Empty Then
|
||||
_logger.Warn("FindUserWithFilter: Filter was empty, returning True for User {0}", User.SamAccountName)
|
||||
_logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", User.SamAccountName)
|
||||
Return True
|
||||
End If
|
||||
|
||||
If Filter.Contains(oPlaceholder) Then
|
||||
Filter = Filter.Replace(oPlaceholder, User.SamAccountName)
|
||||
Else
|
||||
_logger.Warn("FindUserWithFilter: Placeholder '{0}' was not found in filter. Results may not be correct.")
|
||||
_logger.Warn("FindUserWithFilter: Placeholder [{0}] was not found in filter. Results may not be correct.")
|
||||
End If
|
||||
|
||||
Dim oSearcher As New DirectorySearcher(oEntry, Filter)
|
||||
|
||||
Reference in New Issue
Block a user