summaryrefslogtreecommitdiff
path: root/Services/PrincipalProvider.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-09-29 05:01:45 +1000
committerJake Mannens <jake@asger.xyz>2023-09-29 05:33:04 +1000
commit76e4bf609c3d196bd20619188a317fca66f4a04a (patch)
tree8d6544efc82782f2417f39f31fd05aa76e68316e /Services/PrincipalProvider.cs
parentbedcb6b176130fc2c6bd4657c8af4d407b64c970 (diff)
Separated Principal and LocalPrincipal types
Diffstat (limited to 'Services/PrincipalProvider.cs')
-rw-r--r--Services/PrincipalProvider.cs22
1 files changed, 18 insertions, 4 deletions
diff --git a/Services/PrincipalProvider.cs b/Services/PrincipalProvider.cs
index e75c6c7..6991c64 100644
--- a/Services/PrincipalProvider.cs
+++ b/Services/PrincipalProvider.cs
@@ -1,9 +1,23 @@
namespace HyperBooru.Services;
-public abstract class PrincipalProvider {
- public abstract bool ValidatePassword(HBPrincipal principal, string password);
+public interface IPrincipalProvider {
+ public Principal? GetPrincipal(string name);
+ public User? GetUser(string name);
+ public Group? GetGroup(string name);
- public abstract HBPrincipal GetPrincipal(string username);
+ public Group[] GetGroups(Principal principal);
+ public Group[] GetGroups(Principal principal, bool recurse);
- public abstract Group[] GetAllGroups(HBPrincipal principal);
+ public bool ValidatePassword(User user, string password);
+}
+
+public abstract class PrincipalProvider : IPrincipalProvider {
+ public abstract Principal? GetPrincipal(string name);
+ public abstract User? GetUser(string name);
+ public abstract Group? GetGroup(string name);
+
+ public Group[] GetGroups(Principal principal) => GetGroups(principal, false);
+ public abstract Group[] GetGroups(Principal principal, bool recurse);
+
+ public abstract bool ValidatePassword(User user, string password);
}