Foxtable(狐表)用户栏目专家坐堂 → 角色设置出错


  共有2865人关注过本帖树形打印复制链接

主题:角色设置出错

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/27 16:32:00 [显示全部帖子]

If user.Type = UserTypeEnum.Developer = False Then
    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("可见")
                End If
                If Tables(dr("表名")).AllowEdit = False Then
                    Tables(dr("表名")).AllowEdit = dr("可编辑")
                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

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/27 16:34:00 [显示全部帖子]

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("可见")
                End If
                If Tables(dr("表名")).AllowEdit = False Then
                    Tables(dr("表名")).AllowEdit = dr("可编辑")
                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

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/27 17:06:00 [显示全部帖子]

 看4楼代码。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/27 19:09:00 [显示全部帖子]

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编辑过]

 回到顶部