以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 角色设置出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=63737) |
||||
-- 作者:ss -- 发布时间:2015/1/27 16:17:00 -- 角色设置出错 请教下各位大师,设计的权限出现错误,麻烦帮看下,开发密码888,其它123. For Each t As Table In Tables t.Visible = False t.AllowEdit = False For
Each c As c.Visible = False c.AllowEdit = False Next Next Dim roles As String = "\'" &
_UserGroup.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 |
||||
-- 作者:Bin -- 发布时间:2015/1/27 16:25:00 -- 你用的不是自定义用户管理 你为何用全局变量来判断呢 Dim roles As String = "\'" & _UserGroup.Replace(",", "\',\'") & "\'" 这是不对的. user.group才对. 而且没看懂你这个代码的意图? 你用户组是有多个的,这个方式?
|
||||
-- 作者:有点甜 -- 发布时间: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 |
||||
-- 作者:有点甜 -- 发布时间: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 |
||||
-- 作者:ss -- 发布时间:2015/1/27 17:01:00 -- 甜老师输了没报错,但是看不见表是怎么一回事呢? |
||||
-- 作者:Bin -- 发布时间:2015/1/27 17:02:00 -- 权限问题.用开发者登录看 |
||||
-- 作者:有点甜 -- 发布时间:2015/1/27 17:06:00 -- 看4楼代码。 |
||||
-- 作者:ss -- 发布时间:2015/1/27 18:30:00 -- 看不见列啊 |
||||
-- 作者:有点甜 -- 发布时间:2015/1/27 19:09:00 -- If user.Type = UserTypeEnum.Developer Then [此贴子已经被作者于2015-1-27 19:09:50编辑过]
|
||||
-- 作者:ss -- 发布时间:2015/1/27 22:34:00 -- 没注意看,随便设置权限问题,谢谢甜老师、Bin老师 |