diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-18 19:34:14 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-09-18 19:34:14 +1000 |
| commit | cb8179b5e5a8d5253d063ed607205f52643410fa (patch) | |
| tree | ea5ab297ba2876ba4db236ae700b03f5aba0459b /Acl.cs | |
| parent | 604ef537e0fabfbcc3abf9d7473b22f08dc549a6 (diff) | |
Initial commit
Diffstat (limited to 'Acl.cs')
| -rw-r--r-- | Acl.cs | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +namespace HyperBooru; + +public enum AclRuleAction { + Allow, + Deny +} + +public class Acl : HBObject { + public HBObject Subject { get; set; } + public List<AclRule> Rules { get; set; } +} + +public class Acl<T> : Acl where T : Enum { + public Type Type => typeof(T); + + public new List<AclRule<T>> Rules { + get => base.Rules.Cast<AclRule<T>>().ToList(); + set => base.Rules = value.Cast<AclRule>().ToList(); + } +} + +public class AclRule : HBObject { + public HBPrincipal Principal { get; set; } + public AclRuleAction Action { get; set; } + public ulong Permissions { get; set; } +} + +public class AclRule<T> : AclRule where T : Enum { + public Type Type => typeof(T); + + public new T Permissions { + get => (T) (object) base.Permissions; + set => base.Permissions = (ulong) (object) value; + } +} |
