feature: RBAC + Clinical Audit Logging

This commit is contained in:
voltsrage
2026-06-21 15:46:55 +08:00
parent a43db52813
commit 5af6ab490e
83 changed files with 4281 additions and 70 deletions
@@ -0,0 +1,24 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
public static class TestAuthContext
{
public static void AsNurse(
IServiceProvider services,
Guid? userId = null,
string displayName = "Test Nurse")
{
var accessor = services.GetRequiredService<IHttpContextAccessor>();
var context = new DefaultHttpContext();
var claims = new[]
{
new Claim(ClaimTypes.NameIdentifier, (userId ?? Guid.NewGuid()).ToString()),
new Claim(ClaimTypes.Name, "test-nurse"),
new Claim("display_name", displayName),
new Claim("clinical_role", "NURSE"),
};
context.User = new ClaimsPrincipal(new ClaimsIdentity(claims, TestingAuthHandler.SchemeName));
accessor.HttpContext = context;
}
}