Foxtable(狐表)用户栏目专家坐堂 → [求助]使用角色进行可视化授权


  共有6674人关注过本帖平板打印复制链接

主题:[求助]使用角色进行可视化授权

帅哥哟,离线,有人找我吗?
yyzlxc
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1525 积分:10580 威望:0 精华:0 注册:2008/9/24 11:16:00
[求助]使用角色进行可视化授权  发帖心情 Post By:2012/7/10 13:52:00 [只看该作者]

原来的项目是根据用户分组进行授权,现在打算按照角色来授权,将用户组改成角色,并将扩展列类型设置为多值字段,最后对代码应该如何修改,才能达到按照角色来授权的效果,请各位老师指教,谢谢!!

 

'按分组的可视化授权代码
For Each t As Table In Tables
    t.Visible = True
    t.AllowEdit = True
    For Each c As Col In t.Cols
        c.Visible = True
        c.AllowEdit = True
    Next
Next
Dim ds As DataRow
Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )
If User.Type = UserTypeEnum.User Then
    For Each ds In DataTables("授权表").Select("用户组 = '" & _UserGroup & "'" )
        If ds.IsNull("列名") Then
            Tables(ds("表名")).Visible = Not ds("不可见")
            Tables(ds("表名")).AllowEdit = Not ds("不可编辑")
        Else
            Tables(ds("表名")).Cols(ds("列名")).Visible = Not ds("不可见")
            Tables(ds("表名")).Cols(ds("列名")).AllowEdit = Not ds("不可编辑")
        End If
    Next
End If


 回到顶部