diff --git a/Interfaces/ActiveDirectoryInterface.vb b/Interfaces/ActiveDirectoryInterface.vb index 0c8a04c3..9375aa5d 100644 --- a/Interfaces/ActiveDirectoryInterface.vb +++ b/Interfaces/ActiveDirectoryInterface.vb @@ -221,9 +221,12 @@ Public Class ActiveDirectoryInterface End Try End Function - Public Function FindUserWithFilter(User As UserPrincipalEx, Filter As String) As Boolean + Public Function FindUserWithFilter(pUser As UserPrincipalEx, pFilter As String) As Boolean Try - Dim oRootPath = String.Join(","c, User.DistinguishedName.Split(","c).Skip(1)) + Dim oRootPath = String.Join(","c, pUser.DistinguishedName.Split(","c).Skip(1)) + _logger.Debug("FindUserWithFilter: pUser.DistinguishedName: [{0}]", pUser.DistinguishedName) + _logger.Debug("FindUserWithFilter: oRootPath from User.DistinguishedName - oRootPath: [{0}]", oRootPath) + Dim oPlaceholder = "@SAMACCOUNTNAME" Dim oProtocol = "LDAP://" Dim oEntry As New DirectoryEntry(oProtocol & oRootPath) With { @@ -231,22 +234,24 @@ Public Class ActiveDirectoryInterface .Password = Nothing, .AuthenticationType = AuthenticationTypes.Secure } - - If Filter = String.Empty Then - _logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", User.SamAccountName) + _logger.Debug("FindUserWithFilter: got oDirectoryEntry (Path): [{0}]", oProtocol & oRootPath) + If pFilter = String.Empty Then + _logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", pUser.SamAccountName) Return True End If - If Filter.Contains(oPlaceholder) Then - Filter = Filter.Replace(oPlaceholder, User.SamAccountName) + If pFilter.Contains(oPlaceholder) Then + pFilter = pFilter.Replace(oPlaceholder, pUser.SamAccountName) + _logger.Debug("FindUserWithFilter: Filter.Contains(oPlaceholder) [{0}]", pFilter) Else _logger.Warn("FindUserWithFilter: Placeholder [{0}] was not found in filter. Results may not be correct.") End If - Dim oSearcher As New DirectorySearcher(oEntry, Filter) + Dim oSearcher As New DirectorySearcher(oEntry, pFilter) + _logger.Debug("FindUserWithFilter: oSearcher created! Now executing DirectoryServices.SearchResult with .FindOne ...") Dim oResult As SearchResult = oSearcher.FindOne() - - If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = User.DistinguishedName Then + _logger.Debug("FindUserWithFilter: We have an oResult - oResult.Path: [{0}]", oResult.Path) + If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = pUser.DistinguishedName Then Return True Else Return False diff --git a/Interfaces/My Project/AssemblyInfo.vb b/Interfaces/My Project/AssemblyInfo.vb index 52957d41..370f119b 100644 --- a/Interfaces/My Project/AssemblyInfo.vb +++ b/Interfaces/My Project/AssemblyInfo.vb @@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + +