blob: 72d0bf2d89a2d18e2b73d4226c23f0c600b47997 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System.ComponentModel.DataAnnotations.Schema;
namespace HyperBooru;
public enum AclRuleAction {
Allow,
Deny
}
public class Acl : HBObject {
[ForeignKey("ObjectId")]
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;
}
}
|