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 /Services/SecurityService.cs | |
| parent | 604ef537e0fabfbcc3abf9d7473b22f08dc549a6 (diff) | |
Initial commit
Diffstat (limited to 'Services/SecurityService.cs')
| -rw-r--r-- | Services/SecurityService.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Services/SecurityService.cs b/Services/SecurityService.cs new file mode 100644 index 0000000..9695254 --- /dev/null +++ b/Services/SecurityService.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore; + +namespace HyperBooru.Services; + +public class SecurityService { + private IDbContextFactory<HBContext> dbFactory; + + private Acl[] acls; + + public SecurityService(IDbContextFactory<HBContext> dbFactory) { + this.dbFactory = dbFactory; + Reload(); + } + + public void Reload() { + using var db = dbFactory.CreateDbContext(); + acls = db.Acls + .Include(a => a.Rules) + .ThenInclude(r => r.Principal) + .ToArray(); + } + + public IEnumerable<HBObject> Filter(IEnumerable<HBObject> objects, ulong permissions) { + foreach(var obj in objects) { + } + + return Enumerable.Empty<HBObject>(); + } +} |
