Deliver portable native Architecture B deployment and final verification

This commit is contained in:
Steffen committed 2026-10-14 16:32:20 +02:00
1 parent f451b55de1
commit 36740d2492
92 files changed
+10939 -926

No files matched your search

+8 -7
View File
@@ -1,12 +1,13 @@
using System.Security.Claims;
using HealthApp.Contracts;
namespace HealthApp.Security;
public sealed class AccessPolicy(ProfileQueries profiles,ProfessionalAssignments assignments)
public sealed class AccessPolicy(ProfileQueries profiles, ProfessionalAssignments assignments)
{
public async Task<AuthorizedPatientContext?> AuthorizeAsync(ClaimsPrincipal user,Guid actualPatient,bool write,CancellationToken ct)
{
var account=user.FindFirstValue(ClaimTypes.NameIdentifier)!;
bool allowed=user.IsInRole("HealthcareProfessional") ? !write&&assignments.IsAssigned(account,actualPatient) : user.IsInRole("Patient")&&await profiles.ResolveAccountAsync(account,ct)==actualPatient;
return allowed?new AuthorizedPatientContext(actualPatient,write):null;
}
public async Task<AuthorizedPatientContext?> AuthorizeAsync(ClaimsPrincipal user, Guid actualPatient, bool write, CancellationToken ct)
{
var account = user.FindFirstValue(ClaimTypes.NameIdentifier)!;
bool allowed = user.IsInRole("HealthcareProfessional") ? !write && assignments.IsAssigned(account, actualPatient) : user.IsInRole("Patient") && await profiles.ResolveAccountAsync(account, ct) == actualPatient;
return allowed ? new AuthorizedPatientContext(actualPatient, write) : null;
}
}