CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005
    Posts
    56

    creating permissions

    i created a module storing my logged in user's Login ID (gintLoginID). this information will be passed around when in need. Now i'm currently in another form and this form contains a few buttons namely, Add, Edit and Delete. All users are given a role Entry, Update, View.

    is it possible for me to check using gintLoginID the role of the logged in user?
    i want to make buttons available for certain users. eg. Entry role has add, edit and delete. Update role has edit and delete. View role has none.

    is it possible? please help

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: creating permissions

    yes, it's possible.

    You need a table storing available options for a given user, then on form load query the table with the user id to find their permissions then set buttons etc accordingly.
    If you find my answers helpful, dont forget to rate me

  3. #3
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Lightbulb Re: creating permissions

    I pass the Permissions of the user,after confirmed login, to a Global defined Array of Boolean type (In a module)...

    then throughout me code if i need to check the permitions or access rights i use..
    Code:
    Private Form_Load ()
        Frm.Tool_Acc.Enabled = Acc(8)   'Set Menu rights to user..
        Frm.Tool_Print.Enabled = Acc(9)
        Frm.Tool_Staff.Enabled = Acc(6)
        Frm.Tool_Supp.Enabled = Acc(7)
        Frm.Tool_User.Enabled = Acc(10)
        Frm.Main_Func.Enabled = Acc(3)
        Frm.Main_Paym.Enabled = Acc(4)
        Frm.Main_Shift.Enabled = Acc(2)
        Frm.Main_With.Enabled = Acc(5)
    End Sub
    
    -----AND------
    Private Sub Cmd1_Click ()
        if Acc(1) then
             .........
        end if
    end sub
    ----EDIT----
    to use more that one access we use
    Code:
    if Acc(1) and Acc(2) then  ' user must have View and Edit rights to do function
    if Acc(1) or Acc(3) then  ' user can have View or Print rights to do function
    ----- END EDIT-----


    Hope This helps you..


    Gremmy
    Last edited by GremlinSA; November 15th, 2005 at 06:07 AM.
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

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

Featured