Added preprocessor directives for .NET framework compatibility. Modified `using` directives to be framework-specific. Improved code formatting for better readability. Introduced obsolete attributes for deprecated methods, recommending `MediatR` as an alternative. Added XML documentation for clarity and maintainability.
96 lines
4.9 KiB
C#
96 lines
4.9 KiB
C#
#if NET
|
|
using DigitalData.Core.Abstraction.Application.DTO;
|
|
using System.DirectoryServices;
|
|
|
|
namespace DigitalData.Core.Abstraction.Application;
|
|
|
|
[Obsolete("Use DigitalData.ActiveDirectory")]
|
|
public interface IDirectorySearchService
|
|
{
|
|
public string ServerName { get; }
|
|
|
|
public string Root { get; }
|
|
|
|
string SearchRootPath { get; }
|
|
|
|
Dictionary<string, string> CustomSearchFilters { get; }
|
|
|
|
/// <summary>
|
|
/// Creates the connections to the server and returns a Boolean value that specifies
|
|
/// whether the specified username and password are valid.
|
|
/// </summary>
|
|
/// <param name="userName">The username that is validated on the server. See the Remarks section
|
|
/// for more information on the format of userName.</param>
|
|
/// <param name="password">The password that is validated on the server.</param>
|
|
/// <returns>True if the credentials are valid; otherwise, false.</returns>
|
|
bool ValidateCredentials(string userName, string password);
|
|
|
|
/// <summary>
|
|
/// Creates the connections to the server asynchronously and returns a Boolean value that specifies
|
|
/// whether the specified username and password are valid.
|
|
/// </summary>
|
|
/// <param name="userName">The username that is validated on the server. See the Remarks section
|
|
/// for more information on the format of userName.</param>
|
|
/// <param name="password">The password that is validated on the server.</param>
|
|
/// <returns>True if the credentials are valid; otherwise, false.</returns>
|
|
Task<bool> ValidateCredentialsAsync(string userName, string password);
|
|
|
|
/// <summary>
|
|
/// Finds all directory entries matching the specified filter.
|
|
/// </summary>
|
|
/// <param name="searchRoot">The search root.</param>
|
|
/// <param name="filter">The search filter.</param>
|
|
/// <param name="searchScope">The search scope.</param>
|
|
/// <param name="sizeLimit">The size limit.</param>
|
|
/// <param name="properties">The properties to load.</param>
|
|
/// <returns>A <see cref="DataResult{T}"/> containing the results.</returns>
|
|
DataResult<IEnumerable<ResultPropertyCollection>> FindAll(DirectoryEntry searchRoot, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties);
|
|
|
|
/// <summary>
|
|
/// Finds all directory entries matching the specified filter asynchronously.
|
|
/// </summary>
|
|
/// <param name="searchRoot">The search root.</param>
|
|
/// <param name="filter">The search filter.</param>
|
|
/// <param name="searchScope">The search scope.</param>
|
|
/// <param name="sizeLimit">The size limit.</param>
|
|
/// <param name="properties">The properties to load.</param>
|
|
/// <returns>A <see cref="DataResult{T}"/> containing the results.</returns>
|
|
Task<DataResult<IEnumerable<ResultPropertyCollection>>> FindAllAsync(DirectoryEntry searchRoot, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties);
|
|
|
|
/// <summary>
|
|
/// Finds all directory entries matching the specified filter, using the user cache.
|
|
/// </summary>
|
|
/// <param name="username">The username.</param>
|
|
/// <param name="filter">The search filter.</param>
|
|
/// <param name="searchScope">The search scope.</param>
|
|
/// <param name="sizeLimit">The size limit.</param>
|
|
/// <param name="properties">The properties to load.</param>
|
|
/// <returns>A <see cref="DataResult{T}"/> containing the results.</returns>
|
|
DataResult<IEnumerable<ResultPropertyCollection>> FindAllByUserCache(string username, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties);
|
|
|
|
/// <summary>
|
|
/// Finds all directory entries matching the specified filter asynchronously, using the user cache.
|
|
/// </summary>
|
|
/// <param name="username">The username.</param>
|
|
/// <param name="filter">The search filter.</param>
|
|
/// <param name="searchScope">The search scope.</param>
|
|
/// <param name="sizeLimit">The size limit.</param>
|
|
/// <param name="properties">The properties to load.</param>
|
|
/// <returns>A <see cref="DataResult{T}"/> containing the results.</returns>
|
|
Task<DataResult<IEnumerable<ResultPropertyCollection>>> FindAllByUserCacheAsync(string username, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties);
|
|
|
|
/// <summary>
|
|
/// Sets the search root in the cache.
|
|
/// </summary>
|
|
/// <param name="username">The directory entry username.</param>
|
|
/// <param name="password">The directory entry password.</param>
|
|
void SetSearchRootCache(string username, string password);
|
|
|
|
/// <summary>
|
|
/// Gets the search root from the cache.
|
|
/// </summary>
|
|
/// <param name="username">The directory entry username.</param>
|
|
/// <returns>The cached <see cref="DirectoryEntry"/> if found; otherwise, null.</returns>
|
|
DirectoryEntry? GetSearchRootCache(string username);
|
|
}
|
|
#endif |