Results 1 to 6 of 6

Thread: how to implement application of user account

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    how to implement application of user account

    hello. I would like to ask for an idea how to use the username and password in order to know which menus and submenus he or she is allowed to use and also if I have two applications inventory and cashier and I only allow him to use the inventory program.

  2. #2
    gibra
    Guest

    Re: how to implement application of user account

    You can create a Permissions table, related to Users table, which contains the authoritation flags by user.

    When the user connect to program, hide/show menus and submenus in accord to related flag.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Re: how to implement application of user account

    gibra, can you show me the fields of those permission and users table and how the authorization flags work.

  4. #4
    Hyperactive Member
    Join Date
    Oct 2013
    Posts
    389

    Re: how to implement application of user account

    Quote Originally Posted by codesearcher View Post
    gibra, can you show me the fields of those permission and users table and how the authorization flags work.
    what he means is something like this (only with menus and not Forms):



    Now if you're talking about Menus, you can set all menus to Not Visible by default when you create them.
    and place a sub on Form_Load for example, that will .Visible = True all menus depending on the user access





    P.S
    could it be that you did not explain the situation clear enough, as it seems quite a trivial solution to a trivial issue ... ?
    Last edited by stum; Jun 24th, 2014 at 06:36 AM.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Re: how to implement application of user account

    stum. thanks for making it clear for me with regards to flags.

  6. #6
    Addicted Member masoudk1990's Avatar
    Join Date
    Nov 2013
    Location
    Persia
    Posts
    172

    Re: how to implement application of user account

    Stum architecture is not good and have redundancy.

    Try this architecture:

    user name|menu name
    ----------|-----------
    administrator|menu1
    administrator|menu2
    sarah|menu2

    First you can disable all menus:
    Code:
        For Each i In Me.Controls
            If TypeName(i) = "Menu" Then
                If (i.Caption <> "-") Then
                    i.Enabled = False
                End If
            End If
        Next
    Then enable menus that user should have access:
    Code:
    Dim rs As New ADODB.Recordset
    rs.Open "SELECT * FROM TableAccess WHERE UserName = 'Administrator'", connection, adOpenStatic, adLockReadOnly
    
        rs.MoveFirst
        Do While Not (rs.EOF Or rs.BOF)
        
            For Each i In Me.Controls
                If TypeName(i) = "Menu" Then
                    If Trim(rs!MenuName) = i.Name Then
                        i.Enabled = True
                    End If
                End If
            Next
    
            rs.MoveNext
            
        Loop
        rs.Close
    
        Set rs = Nothing
    Computer Enterprise Masoud Keshavarz
    For more information contact masoudk1990@yahoo.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width