Foxtable(狐表)用户栏目专家坐堂 → 自定义用户后该如何设置权限!


  共有3525人关注过本帖平板打印复制链接

主题:自定义用户后该如何设置权限!

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


加好友 发短信
等级:婴狐 帖子:19 积分:207 威望:0 精华:0 注册:2014/1/25 9:02:00
自定义用户后该如何设置权限!  发帖心情 Post By:2014/2/12 14:22:00 [只看该作者]

定义全局变量:

 

Public _UserName As String
Public
_UserGroup As String

 

做好自定义登录界面后,想根据用户名设置权限代码如下:

教程上是表名和列名“不可编辑”我修改为“可编辑”不知道是否正确。

 

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("用户名 = '" & _UserName & "'" )
        If
dr.IsNull("列名")
Then
       
    Tables(dr("表名")).Visible = Not dr("不可见")
            Tables
(dr("表名")).AllowEdit = dr("可编辑")

        Else
           
Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
            Tables
(dr("表名")).Cols(dr("列名")).AllowEdit = dr("可编辑")
        End
If
    Next
End
If

 

通过外部数据表做的授权表。但是设置授权后,发现并没有执行授权。请帮忙分析下问题。


 回到顶部