如何可视化授权的实现用户分组是否显示指定的菜单?
用户权限控制代码:
------------------------------------------------------------------------------------------------------------------------------
If e.DataTable .Name <> "权限管理" Then
If _userGroup <> Nothing Then
Dim roles () As String = _userGroup .Split( ",")
Dim fdr As DataRow
For Each role As String In roles
fdr = DataTables ("权限管理").Find ("表名称 = '" & e. DataTable.Name & "' And (列名称 is null or 列名称 = '" & e.DataCol .Name & "' or 列名称 like '" & e.DataCol .Name & ",*' or 列名称 like '*," & e.DataCol .Name & ",*' or 列名称 like '*," & e.DataCol .Name & "') And (编辑行 = '" & role & "' or 编辑行 like '" & role & ",*' or 编辑行 like '*," & role & ",*' Or 编辑行 like '*," & role & "')")
If fdr IsNot Nothing Then
Exit For
End If
Next
If fdr Is Nothing Then
e.Cancel = True '没有对应的权限
Messagebox.Show("你没有修改的权限" ,"提示", MessageBoxButtons.OK,MessageBoxIcon .Information)
End If
End If
End If
----------------------------------------------------------------------------------------------------------------------------------------------------------
菜单隐藏和显示控制代码:
----------------------------------------------------------------------------------------------------------------------------------------------------------
If User.Name = "录入员" Then
RibbonTabs("Other").Groups("Execute").Items("SQLExecute").Visible = False
RibbonTabs("Other").Groups("Execute").Items("Command").Visible = False
Else
RibbonTabs("Other").Groups("Execute").Items("SQLExecute").Visible = True
RibbonTabs("Other").Groups("Execute").Items("Command").Visible = True
End If
-------------------------------------------------------------------------------------------------------------------
老大们帮忙看看能不能结合【用户权限控制代码】和【菜单隐藏和显示控制代码】,以及根据以下【菜单名称】数据表,修改一段代码可以可视化授权的实现用户分组是否显示指定的菜单。
此主题相关图片如下:用户分组显示菜单.png
权限与菜单管理.foxdb
用户名:admin
密码:admin