!81 修复BUG:修复 Client 示例页面无法打开问题
Merge pull request !81 from Argo/publish
This commit is contained in:
commit
a0b25da459
|
@ -37,5 +37,14 @@ namespace Bootstrap.Client.DataAccess
|
||||||
/// <param name="userName"></param>
|
/// <param name="userName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbContextManager.Create<Menu>()?.RetrieveAllMenus(userName), RetrieveMenusAll) ?? new BootstrapMenu[0];
|
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>
|
/// <param name="userName">当前登录的用户名</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => DbHelper.RetrieveAllMenus(userName);
|
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.AddOnlineUsers();
|
||||||
services.AddBootstrapAdminAuthentication(Configuration);
|
services.AddBootstrapAdminAuthentication(Configuration);
|
||||||
services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireBootstrapAdminAuthorizate().Build());
|
services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireBootstrapAdminAuthorizate().Build());
|
||||||
|
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
|
||||||
|
|
||||||
services.AddControllersWithViews(options =>
|
services.AddControllersWithViews(options =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue