Results 1 to 3 of 3

Thread: Granting access in your program for users

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Granting access in your program for users

    Hello,

    I have a program that when a user logs in they will only be able to do certain things based on there user privilege. Example, low, medium, and full access.

    If the user has low then they can only view, if the use has medium they can edit and add, if they have full then they can do everything.

    The buttons will be disabled for actions that they cannot do.

    In the database, i have entered their privileges as low, med, or full.

    I am not sure if this is the best way to do this, but before each form is loaded, i check there privileges by quering the database. Then disabling button based on their user privilege.

    As this is my first time i have done this, I would like to know how this is done in the real world. Is there is a more efficient method of doing this.

    Many thanks in advance,
    Last edited by steve_rm; Oct 22nd, 2006 at 02:01 AM.
    steve

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Granting access in your program for users

    before each form is loaded, i check there privileges by querying the database
    Maybe you should find a way to check for user privilege once they log in and store it in the user object (assuming you have one)
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Granting access in your program for users

    The most robust and extensible solution would be to have a table of individual privileges that give the user the right to do something. You then have a table of groups and you assign multiple privileges to each group. That means that anyone who belongs to a particular group will inherit all the privileges that that group has. If you add or remove a privilege to or from that group then all members of that group are affected by that change. You then assign each user to one or more groups. That's more work than a simple high, medium and low system but once implented it is the most flexible to use. Making changes is very simple, like adding and removing individual privileges on the system, adding and removing groups, assigning and removing privileges to and from groups and adding and removing users to and from groups.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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