allow search content permissions to support roles

This commit is contained in:
sbwalker 2024-07-17 19:34:19 -04:00
parent 0c80e28754
commit 45afbbdac6

View File

@ -89,6 +89,8 @@ namespace Oqtane.Services
{
var visible = true;
foreach (var permission in searchContent.Permissions.Split(','))
{
if (permission.Contains(":")) // permission
{
var entityName = permission.Split(":")[0];
var entityId = int.Parse(permission.Split(":")[1]);
@ -98,6 +100,15 @@ namespace Oqtane.Services
break;
}
}
else // role name
{
if (!_accessor.HttpContext.User.IsInRole(permission))
{
visible = false;
break;
}
}
}
return visible;
}