C# WinForms 用户/权限管理

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1267952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:27:24  来源:igfitidea点击:

C# WinForms User/Permission management

c#authorization

提问by user366312

Can anyone provide me an example WinForms application that implements the concept of User authentication and authorization one the basis of Roles or Groups?

谁能为我提供一个示例 WinForms 应用程序,该应用程序实现了用户身份验证和授权的概念,即角色或组的基础?

The application should allow access of users to the main-menu on the basis of their roles.

应用程序应允许用户根据其角色访问主菜单。

采纳答案by Robert Harvey

If you are building the menu from a database table, you can security trim it by joining it to another table or view that excludes records on the basis of the permissions set.

如果您从数据库表构建菜单,您可以通过将其连接到另一个表或基于权限集排除记录的视图来安全修剪它。

The diagram below illustrates the basics of setting up role permissions for users, and contains a couple of other tables for security trimming individual controls on the form as well.

下图说明了为用户设置角色权限的基础知识,并包含几个其他表格,用于安全调整表单上的各个控件。

Controls Based Security in a Windows Forms Application
http://www.simple-talk.com/dotnet/windows-forms/controls-based-security-in-a-windows-forms-application/
.

Windows 窗体应用程序中基于控件的安全性
http://www.simple-talk.com/dotnet/windows-forms/controls-based-security-in-a-windows-forms-application/

alt text

替代文字