summaryrefslogtreecommitdiff
path: root/Services
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-10-04 15:59:52 +1100
committerJake Mannens <jake@asger.xyz>2023-10-04 15:59:52 +1100
commitaa0b68f7648bd5a7c14b64737a4f8d3e402bfce5 (patch)
treef058842f77cfbd6e2a21abd3e4f8ad4f8ad1ed9a /Services
parent33438ac951430fa370965b42a3d98a54e704ab01 (diff)
Fix SID equality and WellKnownSid mappings
Diffstat (limited to 'Services')
-rw-r--r--Services/PrincipalProvider.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Services/PrincipalProvider.cs b/Services/PrincipalProvider.cs
index d37e8c0..4b2cf42 100644
--- a/Services/PrincipalProvider.cs
+++ b/Services/PrincipalProvider.cs
@@ -5,6 +5,16 @@ public interface IPrincipalProvider {
public IUser? GetUser(string name);
public IGroup? GetGroup(string name);
+ /// <summary>
+ /// Perform a search for any principals whose account name
+ /// matches the search term specified by <c>name</c>.
+ /// </summary>
+ /// <returns>
+ /// A list of matching principals or <c>null</c> if the
+ /// provider does not support search functionality.
+ /// </returns>
+ public IPrincipal[]? SearchPrincipals(string name);
+
public IGroup[] GetGroups(IPrincipal principal);
public IGroup[] GetGroups(IPrincipal principal, bool recurse);
@@ -19,6 +29,8 @@ public abstract class PrincipalProvider : IPrincipalProvider {
public abstract IUser? GetUser(string name);
public abstract IGroup? GetGroup(string name);
+ public abstract IPrincipal[]? SearchPrincipals(string name);
+
public IGroup[] GetGroups(IPrincipal principal) =>
GetGroups(principal.Sid, false);
public IGroup[] GetGroups(IPrincipal principal, bool recurse) =>
@@ -28,4 +40,9 @@ public abstract class PrincipalProvider : IPrincipalProvider {
public abstract IGroup[] GetGroups(SecurityIdentifier sid, bool recurse);
public abstract bool ValidatePassword(IUser user, string password);
+
+ public void Test() {
+ var ret = SearchPrincipals("lol");
+ Console.WriteLine(ret);
+ }
}