refactor: 重构按钮授权方法
This commit is contained in:
parent
9a3b7a94db
commit
1cb81805c4
|
@ -10,7 +10,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.15" />
|
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.16-preview-1" />
|
||||||
<PackageReference Include="Longbow.Configuration" Version="2.2.7" />
|
<PackageReference Include="Longbow.Configuration" Version="2.2.7" />
|
||||||
<PackageReference Include="Longbow.Tasks" Version="1.10.0" />
|
<PackageReference Include="Longbow.Tasks" Version="1.10.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Bootstrap.Admin
|
||||||
services.AddResponseCompression();
|
services.AddResponseCompression();
|
||||||
services.AddBootstrapAdminAuthentication();
|
services.AddBootstrapAdminAuthentication();
|
||||||
services.AddSwagger();
|
services.AddSwagger();
|
||||||
services.AddButtonAuthorization(MenuHelper.RetrieveAllMenus);
|
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
|
||||||
services.AddBootstrapAdminBackgroundTask();
|
services.AddBootstrapAdminBackgroundTask();
|
||||||
services.AddHttpClient<GiteeHttpClient>();
|
services.AddHttpClient<GiteeHttpClient>();
|
||||||
services.AddAdminHealthChecks();
|
services.AddAdminHealthChecks();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.2.12" />
|
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.2.13-preview-1" />
|
||||||
<PackageReference Include="Longbow.Data" Version="2.3.7" />
|
<PackageReference Include="Longbow.Data" Version="2.3.7" />
|
||||||
<PackageReference Include="Longbow.Logging" Version="2.2.13" />
|
<PackageReference Include="Longbow.Logging" Version="2.2.13" />
|
||||||
<PackageReference Include="Longbow.PetaPoco" Version="1.0.2" />
|
<PackageReference Include="Longbow.PetaPoco" Version="1.0.2" />
|
||||||
|
|
|
@ -125,5 +125,14 @@ namespace Bootstrap.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);
|
public static IEnumerable<BootstrapMenu> RetrieveAllMenus(string userName) => CacheManager.GetOrAdd($"{RetrieveMenusAll}-{userName}", key => DbContextManager.Create<Menu>()?.RetrieveAllMenus(userName), RetrieveMenusAll);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </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) => DbHelper.AuthorizateButtons(userName, url, auths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue