From cd6097d1331dd68030256c63705cacd60abf3234 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 19 Sep 2022 22:01:34 -0500 Subject: [PATCH] default user permission for guest requests --- WebfrontCore/TagHelpers/HasPermission.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WebfrontCore/TagHelpers/HasPermission.cs b/WebfrontCore/TagHelpers/HasPermission.cs index 168fd59c9..4c6108aa9 100644 --- a/WebfrontCore/TagHelpers/HasPermission.cs +++ b/WebfrontCore/TagHelpers/HasPermission.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; +using Data.Models.Client; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Razor.TagHelpers; using SharedLibraryCore; @@ -30,7 +31,7 @@ public class HasPermission : TagHelper { output.TagName = null; var permissionLevel = _contextAccessor?.HttpContext?.User.Claims - .FirstOrDefault(claim => claim.Type == ClaimTypes.Role)?.Value; + .FirstOrDefault(claim => claim.Type == ClaimTypes.Role)?.Value ?? EFClient.Permission.User.ToString(); var hasPermission = permissionLevel != null && _permissionSets.ContainsKey(permissionLevel) && _permissionSets[permissionLevel].HasPermission(Entity, Permission);