If user.Type = UserTypeEnum.Developer Then
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
Else
For Each t As Table In Tables
t.Visible = False
t.AllowEdit = False
For Each c As Col In t.Cols
c.Visible = False
c.AllowEdit = False
Next
Next
If User.Roles <> Nothing Then
Dim roles As String = "'" & User.Roles.Replace(",", "','") & "'"
Dim drs As List(Of DataRow) = DataTables("权限").Select("角色名 in (" & roles & ")")
For Each dr As DataRow In drs
If dr.IsNull("列名") Then
If Tables(dr("表名")).Visible = False Then
Tables(dr("表名")).Visible = dr("可见")
For Each c As Col In Tables(dr("表名")).Cols
If c.Visible = False Then
c.Visible = dr("可见")
End If
Next
End If
If Tables(dr("表名")).AllowEdit = False Then
Tables(dr("表名")).AllowEdit = dr("可编辑")
For Each c As Col In Tables(dr("表名")).Cols
If c.AllowEdit = False
c.AllowEdit = dr("可编辑")
End If
Next
End If
Else
If Tables(dr("表名")).Cols(dr("列名")).Visible = False Then
Tables(dr("表名")).Cols(dr("列名")).Visible = dr("可见")
End If
If Tables(dr("表名")).Cols(dr("列名")).AllowEdit = False Then
Tables(dr("表名")).Cols(dr("列名")).AllowEdit = dr("可编辑")
End If
End If
Next
End If
End If
[此贴子已经被作者于2015-1-27 19:09:50编辑过]