Interfaces V 2.3
This commit is contained in:
parent
ffa8850bf1
commit
766737b4b5
@ -221,9 +221,12 @@ Public Class ActiveDirectoryInterface
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
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
|
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 oPlaceholder = "@SAMACCOUNTNAME"
|
||||||
Dim oProtocol = "LDAP://"
|
Dim oProtocol = "LDAP://"
|
||||||
Dim oEntry As New DirectoryEntry(oProtocol & oRootPath) With {
|
Dim oEntry As New DirectoryEntry(oProtocol & oRootPath) With {
|
||||||
@ -231,22 +234,24 @@ Public Class ActiveDirectoryInterface
|
|||||||
.Password = Nothing,
|
.Password = Nothing,
|
||||||
.AuthenticationType = AuthenticationTypes.Secure
|
.AuthenticationType = AuthenticationTypes.Secure
|
||||||
}
|
}
|
||||||
|
_logger.Debug("FindUserWithFilter: got oDirectoryEntry (Path): [{0}]", oProtocol & oRootPath)
|
||||||
If Filter = String.Empty Then
|
If pFilter = String.Empty Then
|
||||||
_logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", User.SamAccountName)
|
_logger.Debug("FindUserWithFilter: Filter was empty, returning True for User [{0}]", pUser.SamAccountName)
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Filter.Contains(oPlaceholder) Then
|
If pFilter.Contains(oPlaceholder) Then
|
||||||
Filter = Filter.Replace(oPlaceholder, User.SamAccountName)
|
pFilter = pFilter.Replace(oPlaceholder, pUser.SamAccountName)
|
||||||
|
_logger.Debug("FindUserWithFilter: Filter.Contains(oPlaceholder) [{0}]", pFilter)
|
||||||
Else
|
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
|
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()
|
Dim oResult As SearchResult = oSearcher.FindOne()
|
||||||
|
_logger.Debug("FindUserWithFilter: We have an oResult - oResult.Path: [{0}]", oResult.Path)
|
||||||
If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = User.DistinguishedName Then
|
If oResult IsNot Nothing AndAlso oResult.Path.Replace(oProtocol, String.Empty) = pUser.DistinguishedName Then
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||||
<Assembly: AssemblyTrademark("2.2.9.0")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.2.9.0")>
|
<Assembly: AssemblyVersion("2.3.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("2.2.9.0")>
|
<Assembly: AssemblyFileVersion("2.3.0.0")>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user