以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  自定义用户管理与可视化授权  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=8031)

--  作者:cxabc123
--  发布时间:2010/8/31 8:15:00
--  自定义用户管理与可视化授权

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
Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )
If User.Type = UserTypeEnum.User Then
    For Each dr As DataRow In DataTables("授权表").Select("分组名 = \'" & User.Group & "\'" )
        If dr.IsNull("列名") Then
            Tables(dr("表名")).Visible = Not dr("不可见")
            Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
        Else
            Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
            Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
        End If
    Next
End If

 

 

以上代码中

1、Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )是什么意思?

2、当使用自定义用户管理时,以上代码要修改哪些地方?

请老大予以指点


--  作者:狐狸爸爸
--  发布时间:2010/8/31 8:33:00
--  
1、User.Type返回用户类型,这行代码的意思是,对于非开发者和管理员,授权表不可见,代码等效于:
 
If User.Type = UserTypeEnum.User  Then
   Tables("授权表").Visible = False
End If
 
2、如果自己设计管理系统,那么是很灵活的,自己定义变量,自己定义类型,你可以:
 
If _UserGroup = "XXX" Then
    Tables("授权表").Visible = False
End If
 
没有规定一定要怎么做,自己想怎么样,就怎么样,编程没有定式。