Foxtable(狐表)用户栏目专家坐堂 → 自定义用户管理与可视化授权


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

主题:自定义用户管理与可视化授权

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


加好友 发短信
等级:四尾狐 帖子:810 积分:5250 威望:0 精华:0 注册:2009/2/6 10:38:00
自定义用户管理与可视化授权  发帖心情 Post By: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、当使用自定义用户管理时,以上代码要修改哪些地方?

请老大予以指点


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


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By: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
 
没有规定一定要怎么做,自己想怎么样,就怎么样,编程没有定式。

 回到顶部