我如何实现用户权限;在VB中启用或禁用基于用户权限的控件 [英] How do I implement user privileges; enable or disable control based on user right in VB

查看:274
本文介绍了我如何实现用户权限;在VB中启用或禁用基于用户权限的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在vb中实现用户权限。登录系统后。从mssql数据库中读取用户的权限。根据用户权限启用,显示窗体上的控件等。权限示例:编辑配置文件,删除配置文件等。

我想知道是否将每个权限实现为具有位类型的列或

放入所有权限具有列类型位的不同行中的权限指定[启用,可见]



我尝试过:



我试过这样做,但我不知道怎么做。

Please I want to implement user permissions in vb. After logging to the system. The user's permissions are read from mssql database. Controls on the forms are enabled, visible etc based on the users permissions. Example of permissions: edit profile, delete profile etc.
And I want to know whether to implement each of the permissions as a column with a bit type or
Put all the permissions in different rows with a column type of bit to specify [enabled, visible]

What I have tried:

I tried to do it but I don't know how to go about it.

推荐答案

有一篇文章来自Jesse Liberty对此进行了详细讨论。我担心代码示例是在C#中,但它们应该很容易翻译。



基于控件的Windows窗体应用程序安全性 [ ^ ]



更简单的方法可能是为不同的用户类型设置不同的表单
There is an article by Jesse Liberty that discusses this in some detail. I'm afraid the code samples are in C# but they should be easy enough to translate.

Controls Based Security in a Windows Forms Application[^]

A simpler way might be to have different forms for different user types


这篇关于我如何实现用户权限;在VB中启用或禁用基于用户权限的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆