Fix #2230 - add support for an Unauthenticated User global role

This commit is contained in:
Shaun Walker
2022-06-07 15:25:44 -04:00
parent 45984a8166
commit 79c8126c4a
8 changed files with 37 additions and 16 deletions

View File

@ -104,11 +104,14 @@ namespace Oqtane.Security
private static bool IsAllowed(int userId, string roles, string permission)
{
if (permission == RoleNames.Unauthenticated)
{
return userId == -1;
}
if ("[" + userId + "]" == permission)
{
return true;
}
if (roles != null)
{
return roles.IndexOf(";" + permission + ";") != -1;