Merge pull request #5483 from sbwalker/dev
add authorization convenience methods to ModuleBase
This commit is contained in:
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Security;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
@ -147,6 +148,7 @@ namespace Oqtane.Modules
|
||||
}
|
||||
|
||||
// fingerprint hash code for static assets
|
||||
|
||||
public string Fingerprint
|
||||
{
|
||||
get
|
||||
@ -155,6 +157,18 @@ namespace Oqtane.Modules
|
||||
}
|
||||
}
|
||||
|
||||
// authorization methods
|
||||
|
||||
public bool IsAuthorizedRole(string roleName)
|
||||
{
|
||||
return UserSecurity.IsAuthorized(PageState.User, roleName);
|
||||
}
|
||||
|
||||
public bool IsAuthorizedPermission(string permissionName)
|
||||
{
|
||||
return UserSecurity.IsAuthorized(PageState.User, permissionName, ModuleState.PermissionList);
|
||||
}
|
||||
|
||||
// url methods
|
||||
|
||||
// navigate url
|
||||
@ -417,6 +431,9 @@ namespace Oqtane.Modules
|
||||
await interop.ScrollTo(0, 0, "smooth");
|
||||
}
|
||||
|
||||
|
||||
// token replace methods
|
||||
|
||||
public string ReplaceTokens(string content)
|
||||
{
|
||||
return ReplaceTokens(content, null);
|
||||
@ -501,6 +518,7 @@ namespace Oqtane.Modules
|
||||
}
|
||||
|
||||
// date conversion methods
|
||||
|
||||
public DateTime? UtcToLocal(DateTime? datetime)
|
||||
{
|
||||
// Early return if input is null
|
||||
|
Reference in New Issue
Block a user