fix: Client 演示工程无法打开 Home/Dummy 视图错误
This commit is contained in:
parent
d003d2aaac
commit
fb40cfff10
|
@ -37,5 +37,14 @@ namespace Bootstrap.Client.DataAccess
|
|||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbContextManager.Create<Menu>()?.RetrieveAllMenus(userName), RetrieveMenusAll) ?? new BootstrapMenu[0];
|
||||
|
||||
/// <summary>
|
||||
/// 通过当前用户名与指定菜单路径获取此菜单下所有授权按钮集合 (userName, url, auths) => bool
|
||||
/// </summary>
|
||||
/// <param name="userName">当前操作用户名</param>
|
||||
/// <param name="url">资源按钮所属菜单</param>
|
||||
/// <param name="auths">资源授权码</param>
|
||||
/// <returns></returns>
|
||||
public static bool AuthorizateButtons(string userName, string url, string auths) => DbContextManager.Create<Menu>()?.AuthorizateButtons(userName, url, auths) ?? false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,5 +15,18 @@ namespace Bootstrap.Client.DataAccess
|
|||
/// <param name="userName">当前登录的用户名</param>
|
||||
/// <returns></returns>
|
||||
public virtual IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => DbHelper.RetrieveAllMenus(userName);
|
||||
|
||||
/// <summary>
|
||||
/// 通过当前用户名与指定菜单路径获取此菜单下所有授权按钮集合 (userName, url, auths) => bool
|
||||
/// </summary>
|
||||
/// <param name="userName">当前操作用户名</param>
|
||||
/// <param name="url">资源按钮所属菜单</param>
|
||||
/// <param name="auths">资源授权码</param>
|
||||
/// <returns></returns>
|
||||
public virtual bool AuthorizateButtons(string userName, string url, string auths)
|
||||
{
|
||||
var menus = MenuHelper.RetrieveAllMenus(userName);
|
||||
return DbHelper.AuthorizateButtons(menus, url, auths);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace Bootstrap.Client
|
|||
services.AddOnlineUsers();
|
||||
services.AddBootstrapAdminAuthentication(Configuration);
|
||||
services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireBootstrapAdminAuthorizate().Build());
|
||||
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
|
||||
|
||||
services.AddControllersWithViews(options =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue