From cb8179b5e5a8d5253d063ed607205f52643410fa Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 18 Sep 2023 19:34:14 +1000 Subject: Initial commit --- Services/SecurityService.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Services/SecurityService.cs (limited to 'Services') 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 dbFactory; + + private Acl[] acls; + + public SecurityService(IDbContextFactory 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 Filter(IEnumerable objects, ulong permissions) { + foreach(var obj in objects) { + } + + return Enumerable.Empty(); + } +} -- cgit v1.3