以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于取消系统自带登陆,用自己的登陆界面和“用户”表  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=86287)

--  作者:qry99
--  发布时间:2016/6/14 21:52:00
--  [求助]关于取消系统自带登陆,用自己的登陆界面和“用户”表

我不想用系统自带的登陆,所以自己设计了登陆界面、修改密码界面,还建了“员工”表存放用户信息,这样便于后面做权限控制,现在问题是怎么取消系统自带登陆,用自己的登陆界面和“用户”表

1、用自己的登陆窗口,可以方便用户自己修改密码


此主题相关图片如下:01.png
按此在新窗口浏览图片

2、用自己建了“员工”表存放用户信息,这样便于后面做权限控制

此主题相关图片如下:02.png
按此在新窗口浏览图片

此主题相关图片如下:03.png
按此在新窗口浏览图片

 


 


--  作者:qry99
--  发布时间:2016/6/14 21:56:00
--  

自动用默认用户登陆了,然后我用自己的登陆界面登陆其他帐号,没有任何区别


图片点击可在新窗口打开查看此主题相关图片如下:05.png
图片点击可在新窗口打开查看

问题是我设置了权限表,根据用户分组来区分表和列的可见不可见,可编辑不可编辑


图片点击可在新窗口打开查看此主题相关图片如下:04.png
图片点击可在新窗口打开查看

 

求助各位大神,谢谢


--  作者:大红袍
--  发布时间:2016/6/15 0:13:00
--  

1、取消系统自带的登陆。设置一个默认用户即可

 

http://www.foxtable.com/help/topics/1796.htm

 

2、有什么问题?你权限表的数据不生效?你控制可见、可编辑的代码怎么写?如果是帮助文档那里的,只需要把 User.Name,User.Group对应改成_UserName,_UserGroup 即可。


--  作者:qry99
--  发布时间:2016/6/15 10:07:00
--  

代码如下:

AfterOpenProject


For Each t As Table In Tables

    t.Visible = True

    For Each c As Col In t.Cols

        c.Visible = True

        c.AllowEdit = True

    Next

Next


Forms("login").Show()


Dim roles() As String = _UserGroup.Split(",")


For Each role As String In roles

    Dim drs As List(Of DataRow) = DataTables("Authorization").Select("Visual = \'" & role & "\' or Visual like \'" & role & ",*\' or Visual like \'*," & role & ",*\' Or Visual like \'*," & role & "\'")

    For Each dr As DataRow In drs

        If dr.Isnull("Tables") AndAlso dr.Isnull("Columns") Then

            For Each t As Table In Tables

                t.Visible = False

            Next

        Else If dr.isnull("Columns") Then

            Tables(dr("Tables")).Visible = False

            For Each c As Col In Tables(dr("Tables")).Cols

                c.Visible = False

            Next

        Else

            Tables(dr("Tables")).Visible = False

            For Each c As Col In Tables(dr("Tables")).Cols

                If dr("Columns") = c.name OrElse dr("Columns") Like c.name & ",*" OrElse dr("Columns") Like "*," & c.name & ",*" OrElse dr("Columns") Like "*," & c.name Then

                    c.Visible = False

                End If

            Next

        End If

    Next

    

    drs = DataTables("Authorization").Select("Edit = \'" & role & "\' or Edit like \'" & role & ",*\' or Edit like \'*," & role & ",*\' Or Edit like \'*," & role & "\'")

    For Each dr As DataRow In drs

        If dr.Isnull("Tables") AndAlso dr.Isnull("Columns") Then

            For Each t As Table In Tables

                t.Visible = False

                t.AllowEdit = False

            Next

        Else If dr.isnull("Columns") Then

            Tables(dr("Tables")).Visible = False

            For Each c As Col In Tables(dr("Tables")).Cols

                c.Visible = False

                c.AllowEdit = False

            Next

        Else

            Tables(dr("Tables")).Visible = False

            For Each c As Col In Tables(dr("Tables")).Cols

                If dr("Columns") = c.name OrElse dr("Columns") Like c.name & ",*" OrElse dr("Columns") Like "*," & c.name & ",*" OrElse dr("Columns") Like "*," & c.name Then

                    c.Visible = False

                    c.AllowEdit = False

                End If

            Next

        End If

    Next

Next


--  作者:qry99
--  发布时间:2016/6/15 10:08:00
--  
用户登录界面的登录按钮click

Dim user As String = e.Form.Controls("ComboBox1").Text
Dim pwd As String = e.Form.Controls("TextBox1").Text
Dim dr As DataRow = DataTables("Staff").Find("Name = \'" & user & "\'")  \'分开查询,防注入登录
If user="" Then
    MessageBox.show("请输入用户名称!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
    Return
Else
    If dr IsNot Nothing Then
        pwd = MD5Encrypt(pwd)
        If pwd = dr("Password") Then
            PopMessage("登陆成功","提示",PopIconEnum.Infomation,1)
            dr("LastLoginTime")=Date.Now
            _UserName = dr("Name")
            _UserLoginName = user
            _UserGroup = dr("Post")
            e.Form.Close()
        Else
            MessageBox.Show("输入的密码错误,请重试!", "出错")
        End If
    End If
End If

--  作者:qry99
--  发布时间:2016/6/15 10:11:00
--  

打开项目后会报错,具体是这样的


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160615101001.png
图片点击可在新窗口打开查看


--  作者:大红袍
--  发布时间:2016/6/15 10:20:00
--  

加入msgbox看看弹出什么

 

msgbox(_UserGroup)

Dim roles() As String = _UserGroup.Split(",")

msgbox(_UserGroup)


--  作者:qry99
--  发布时间:2016/6/15 10:34:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160615101001.png
图片点击可在新窗口打开查看

--  作者:大红袍
--  发布时间:2016/6/15 10:39:00
--  

那你就这样写

 

If _UserGroup = "" Then

    \'一种显示

Else

    \'另一种显示

End If


--  作者:qry99
--  发布时间:2016/6/15 10:47:00
--  

Dim roles() As String = _UserGroup.Split(",")
If _UserGroup = "" Then
MessageBox.Show(_UserGroup & "第一次!","提示",MessageBoxButtons.OK)
Else
MessageBox.Show(_UserGroup & "第二次!","提示",MessageBoxButtons.OK)
End If

 

运行后反应和最开始一样,为什么连MessageBox都没看到??