work on jobrunner

This commit is contained in:
Jonathan Jenne
2019-04-10 11:43:15 +02:00
parent 720618f29b
commit 2855cc6208
14 changed files with 103 additions and 54 deletions

View File

@@ -112,29 +112,32 @@ Public Class ActiveDirectoryInterface
Return oSyncedUsers
End Function
Public Sub Authenticate()
Public Function Authenticate() As Boolean
Try
Dim oEntry = GetRootNode()
oEntry.RefreshCache()
_rootNode = oEntry
Return True
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not authenticate with Active Directory.")
Return False
End Try
End Sub
Public Sub Authenticate(Username As String, Password As String)
End Function
Public Function Authenticate(Username As String, Password As String) As Boolean
Try
Dim oEntry = GetRootNode(Username, Password)
oEntry.RefreshCache()
_rootNode = oEntry
Return True
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not authenticate with Active Directory.")
Return False
End Try
End Sub
End Function
Public Function ListGroups(Optional Query As String = "(&(objectClass=group) (samAccountName=*))") As List(Of ADGroup)
Return ListGroups(_rootNode, Query)
@@ -196,27 +199,8 @@ Public Class ActiveDirectoryInterface
Throw ex
End Try
End Function
Public Function ListUsers(GroupNames As List(Of String)) As List(Of ADUser)
Try
Dim oUsers As New List(Of ADUser)
Dim oComparer As New UserEqualityComparer()
For Each oGroup In GroupNames
Dim oGroupUsers = ListUsers(oGroup)
Dim oNewUsers = oGroupUsers.
Except(oUsers, oComparer).
ToList()
oUsers.AddRange(oNewUsers)
Next
Return oUsers
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
End Function
Public Function GetGroupId(GroupName As String) As Integer
Private Function GetGroupId(GroupName As String) As Integer
Try
Dim oSQL As String = $"SELECT FNICM_GET_RECORD4SYSKEY('{GroupName}','002-NAME') from RDB$DATABASE"
Dim oGroupId = _firebird.GetScalarValue(oSQL)