From db4b48e1c3f082ef7cb2241ef1aff7c848a78730 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 6 Sep 2019 12:39:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=8E=88=E6=9D=83=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.DataAccess.csproj | 2 +- src/admin/Bootstrap.DataAccess/Helper/MenuHelper.cs | 2 +- src/admin/Bootstrap.DataAccess/Menu.cs | 13 +++++++++++++ .../Bootstrap.Client.DataAccess.csproj | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index 1e17b2c8..fa810503 100644 --- a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/admin/Bootstrap.DataAccess/Helper/MenuHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/MenuHelper.cs index 71b3d236..4710dda8 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/MenuHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/MenuHelper.cs @@ -133,6 +133,6 @@ namespace Bootstrap.DataAccess /// 资源按钮所属菜单 /// 资源授权码 /// - public static bool AuthorizateButtons(string userName, string url, string auths) => DbHelper.AuthorizateButtons(userName, url, auths); + public static bool AuthorizateButtons(string userName, string url, string auths) => DbContextManager.Create().AuthorizateButtons(userName, url, auths); } } diff --git a/src/admin/Bootstrap.DataAccess/Menu.cs b/src/admin/Bootstrap.DataAccess/Menu.cs index 86bf28e8..6b25830f 100644 --- a/src/admin/Bootstrap.DataAccess/Menu.cs +++ b/src/admin/Bootstrap.DataAccess/Menu.cs @@ -97,5 +97,18 @@ namespace Bootstrap.DataAccess /// 当前登录的用户名 /// public virtual IEnumerable RetrieveAllMenus(string userName) => DbHelper.RetrieveAllMenus(userName); + + /// + /// 通过当前用户名与指定菜单路径获取此菜单下所有授权按钮集合 (userName, url, auths) => bool + /// + /// 当前操作用户名 + /// 资源按钮所属菜单 + /// 资源授权码 + /// + public virtual bool AuthorizateButtons(string userName, string url, string auths) + { + var menus = MenuHelper.RetrieveAllMenus(userName); + return DbHelper.AuthorizateButtons(menus, url, auths); + } } } diff --git a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index 52a79cf6..f7aa62d3 100644 --- a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -5,7 +5,7 @@ - +