|
-
Oct 22nd, 2006, 01:50 AM
#1
Thread Starter
Frenzied Member
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
-
Oct 22nd, 2006, 05:14 AM
#2
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
-
Oct 22nd, 2006, 05:57 AM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|