一个可视化授权的案例,已实现《表权限》表的列名列多值字段功能,可根据《用户》表权限列的值对表A、B、C进行权限管理。
现在的问题是,《用户》表的权限列如果是多值字段(如张2),如何修改以下代码来实现权限管理。
'可视化授权
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
If User.Group <> "厂办" Then
Tables("表权限").Visible = False
Else
Tables("表权限").Visible = True
End If
For Each dr As DataRow In DataTables("表权限").Select("权限 = '" & quanx & "'" )
If dr.IsNull("列名") Then
Tables(dr("表名")).Visible = Not dr("不可见")
Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
Else
Dim nms() As String = dr("列名").Split(",")
For Each nm As String In nms
Tables(dr("表名")).Cols(nm).Visible = Not dr("不可见")
Tables(dr("表名")).Cols(nm).AllowEdit = Not dr("不可编辑")
Next
End If
Next
[此贴子已经被作者于2012-10-24 8:15:18编辑过]