在Windows应用程序C#中向不同级别的用户访问特权 [英] Access privilages to different level of users in windows application C#
问题描述
你好,
我正在使用一个大学管理软件,其中有不同级别的用户,例如管理员,校长,教师.每个用户都有不同级别的特权.因此,并非所有用户都可以使用所有功能.用户将具有其登录名.
所以我的问题是我如何根据每个功能的特权级别来设置对此访问权限... ???
现在,我通过在登录时检查特权级别并将功能菜单项设置为可见或不可见来做到这一点.
他们是否还有其他最佳方法来实现此目标?... ????
预先谢谢....:)
Hello,
Am working on a college management software in which there are different level users such as Admins, Principals, Teachers. Each users have a different level of privileges. So that all the features are not available to all the users. Users will have their logins.
So my problem is how do i set this access to each features according to their level of privilege...???
Now i do this by checking privilege level at login time and set the feature menu item visible or invisible.
Is their any other best way to implement this....????
Advance Thank You.... :)
推荐答案
嗨.
为您的PC提供不同级别的组(管理员,校长,教师)
将适当的组分配给您的用户列表.
然后在您的项目/解决方案中,对于必须由适当的组访问或限制的每种方法,编写如下内容:
Hi.
Provide your PC with different level of groups (Admins, Principals, Teachers)
Assign appropriate group to your users list.
Then in your project/solution, for each method which must be accessible or restricted for appropriate group write something like that:
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
public void SomeMethod()
对于限制使用,请遵循:
for restriction use follow:
[PrincipalPermission(SecurityAction.Deny, Role = @"BUILTIN\Administrators")]
public void SomeMethod()
客户端应用程序服务 [在Windows应用程序 [ ^ ]
有关身份验证和验证的任何框架Windows窗体应用程序的授权? [
Client Application Services[^]
Try the asp.net membership provider in a windows application[^]
Any frameworks on Authentication & Authorization for Windows Form Application?[^]
如果您有后台,请为不同的配置文件设置不同的权限级别.并将它们保存到数据库.
加载特定模块或功能时,请验证当前用户的配置文件并进行适当的限制.
If you have a back office, set different permission level to different profile. And save them to database.
When loading a specific module or feature, verify the profile of the current user and make appropriate restriction.
这篇关于在Windows应用程序C#中向不同级别的用户访问特权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!