WeihanLi.AspNetMvc.AccessControlHelper
1.1.0
Prefix Reserved
See the version list below for details.
dotnet add package WeihanLi.AspNetMvc.AccessControlHelper --version 1.1.0
NuGet\Install-Package WeihanLi.AspNetMvc.AccessControlHelper -Version 1.1.0
<PackageReference Include="WeihanLi.AspNetMvc.AccessControlHelper" Version="1.1.0" />
paket add WeihanLi.AspNetMvc.AccessControlHelper --version 1.1.0
#r "nuget: WeihanLi.AspNetMvc.AccessControlHelper, 1.1.0"
// Install WeihanLi.AspNetMvc.AccessControlHelper as a Cake Addin #addin nuget:?package=WeihanLi.AspNetMvc.AccessControlHelper&version=1.1.0 // Install WeihanLi.AspNetMvc.AccessControlHelper as a Cake Tool #tool nuget:?package=WeihanLi.AspNetMvc.AccessControlHelper&version=1.1.0
GetStarted
Nuget Package https://www.nuget.org/packages/WeihanLi.AspNetMvc.AccessControlHelper/
安装权限控制组件
WeihanLi.AspNetMvc.AccessControlHelper
asp.net:
Install-Package WeihanLi.AspNetMvc.AccessControlHelper
asp.net core:
dotnet add package WeihanLi.AspNetMvc.AccessControlHelper
实现自己的权限控制显示策略类
- 实现页面元素显示策略接口
IControlAccessStrategy
- 实现
Action
访问显示策略接口IActionAccessStrategy
示例代码:
- ASP.NET Mvc
- ASP.NET Core
https://github.com/WeihanLi/AccessControlHelper/blob/master/samples/AccessControlDemo/Startup.cs#L60
- 实现页面元素显示策略接口
程序启动时注册自己的显示策略
- asp.net mvc
在
Global
文件中注册显示策略AccessControlHelperExtensions.RegisterAccessStragety(new AccessControlHelperOptions { ActionAccessStrategy = new ActionAccessStrategy(), ControlAccessStrategy = new ControlAccessStrategy() });
- asp.net core
在
Startup
文件中注册显示策略// Method1 app.UseAccessControlHelper(options => { options.ActionAccessStrategy = new ActionAccessStrategy(), options.ControlAccessStrategy = new ControlAccessStrategy() }); // Method2 app.UseAccessControlHelper(new AccessControlHelperOptions { ActionAccessStrategy = new ActionAccessStrategy(), ControlAccessStrategy = new ControlAccessStrategy() });
控制
Action
的方法权限通过
AccessControl
和NoAccessControl
Filter 来控制Action
的访问权限控制页面元素的显示
通过
HtmlHelper
扩展方法来实现权限控制SparkContainer
使用没有权限访问就不会渲染到页面上,有权限访问时才会渲染到页面上,使用详见https://github.com/WeihanLi/AccessControlHelper
Contact
如果您在使用中遇到了问题,欢迎随时与我联系。
Contact me: weihanli@outlook.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- Microsoft.AspNet.Mvc (>= 3.0.20105.1)
-
.NETStandard 2.0
- Microsoft.AspNetCore.Mvc (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.13.0 | 1,166 | 10/19/2020 |
1.12.0 | 1,221 | 1/27/2020 |
1.11.0 | 693 | 1/19/2020 |
1.10.0 | 822 | 12/8/2019 |
1.10.0-preview-20191204-022215 | 442 | 12/4/2019 |
1.9.2 | 791 | 10/20/2019 |
1.9.1 | 744 | 10/15/2019 |
1.9.0 | 818 | 9/24/2019 |
1.8.2 | 806 | 9/3/2019 |
1.8.0 | 1,172 | 6/21/2019 |
1.6.0 | 1,145 | 2/21/2019 |
1.5.0 | 914 | 11/20/2018 |
1.4.0 | 968 | 10/10/2018 |
1.3.1 | 1,190 | 12/9/2017 |
1.1.0 | 1,226 | 10/16/2017 |
handle permission check move from ActionFilter to IAuthorizationFilter