JobRunner: add option to disable Firebird sync

This commit is contained in:
Jonathan Jenne 2019-04-30 16:54:04 +02:00
parent 50d205717f
commit 7d1c2ced5a
4 changed files with 24 additions and 6 deletions

View File

@ -2,4 +2,6 @@
Inherits JobArgs Inherits JobArgs
Public RootPath As String Public RootPath As String
Public DisableFirebird As String
Public DisableMSSQL As String
End Class End Class

View File

@ -1,7 +1,7 @@
Imports System.Collections.Generic Imports System.Collections.Generic
Imports System.Data
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Interfaces Imports DigitalData.Modules.Interfaces
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Public Class ADSyncJob Public Class ADSyncJob
@ -26,13 +26,21 @@ Public Class ADSyncJob
Exit Sub Exit Sub
End If End If
Dim oGroups As List(Of ADGroup) = oSync.ListGroups() 'Dim oGroups As List(Of ADGroup) = oSync.ListGroups()
_Logger.Debug("Found {0} Groups", oGroups.Count) ' 30.04.19: MSSQL als führendes System
Dim oGroups As New List(Of String)
Dim oDatatable = _MSSQL.GetDatatable("SELECT NAME FROM TBDD_GROUPS WHERE AD_SYNC = 1 AND ACTIVE = 1")
_Logger.Debug("Found {0} Groups", oDatatable.Rows.Count)
For Each oRow As DataRow In oDatatable.Rows
oGroups.Add(oRow.Item("NAME"))
Next
For Each oGroup In oGroups For Each oGroup In oGroups
_Logger.Debug("Syncing Group {0}", oGroup.Name) _Logger.Debug("Syncing Group {0}", oGroup)
Dim oSyncedUsers = oSync.SyncUsersForGroup(oGroup.Name) Dim oSyncedUsers = oSync.SyncUsersForGroup(oGroup)
If oSyncedUsers Is Nothing Then If oSyncedUsers Is Nothing Then
_Logger.Warn("Group {0} could not be synced!", oGroup) _Logger.Warn("Group {0} could not be synced!", oGroup)

View File

@ -254,7 +254,7 @@ Public Class ActiveDirectoryInterface
Try Try
Return Result.Properties.Item(PropertyName).Item(0) Return Result.Properties.Item(PropertyName).Item(0)
Catch ex As Exception Catch ex As Exception
_logger.Warn("Property {0} not found", PropertyName) _logger.Debug("Property {0} not found", PropertyName)
Return String.Empty Return String.Empty
End Try End Try
End Function End Function

View File

@ -105,6 +105,14 @@ Public Class JobRunner
oADJobArgs.RootPath = oArgs.Item("RootPath") oADJobArgs.RootPath = oArgs.Item("RootPath")
End If End If
If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then
oFirebird = Nothing
End If
If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then
oMSSQL = Nothing
End If
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL) Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
oADSyncJob.Start(oADJobArgs) oADSyncJob.Start(oADJobArgs)