Deliver portable native Architecture B deployment and final verification
This commit is contained in:
1 parent
f451b55de1
commit
36740d2492
92 files changed
+10939
-926
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user