Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display menu/toolbars based on user rights/access

Status
Not open for further replies.

WETFOX

Programmer
Jun 23, 2002
61
SA
I have a little problem on how to display related toolbars and menus that depend on user's rights/access.
I am using MS SQL Server as backend on D7.

What I wanted to do is display appropriate bars/menus for administrator (I have administrator-related menu items in my app) if the user is logged on as sysadmin on MSSQL. If the user is logged on as plain user with read/write/access on MSSQL Server, then the corresponding toolbars/menus for that user will be displayed.

Can anybody help coz I'm trapped in this part.....thanx!!

ERA
 
Well, I am not as experienced as some, so there may be a better way to do this than my suggestion, but, here goes:

My database has a small table in it as well for the user information. Am not sure if yours does as well, but if it does, great! Since they have to log on, I would suspect there is something like this in there somewhere. But I have a field for their access level in that table. In that field is either a V for View Only, M for Manager, or A for admin. When the user logs on my program will keep track of that information after verifying their login. Then the login form will remove some buttons or a menu section by setting the visible property to false depending on the access. Other forms when activated will check this access level to remove a button here or there.

I hope I portrayed my idea well. If you need more information, let me know.

~
Give a man some fire, he will be warm for a day, Set a man on fire, he will be warm for the rest of his life.
 
Have a boolean public variable CanSee and in the oncreate of the form that contains the menu set the menu option visible = CanSee...

HTH


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Ahhh that is a hair simpler. Removes the one line for the if statement.
Excellent!!

~
Give a man some fire, he will be warm for a day, Set a man on fire, he will be warm for the rest of his life.
 
thanks guys! i'll try ur suggestions

ERA
 
jsty a sort of follow up Q.

I don't have a table for user's rights and access. Everything is dependent on MS SQL SERVER.

I just want to know if there is an exposed vars from the backend in which i can play with with Delphi IDE and determine the users/rights. From that point, I will toggle my programs menus/bars

ERA
 
I'd post that question in Forum183 or Forum962

Leslie
 
thanks again guys for helping me. Hope you're stil be there when i need help (w/c i'm sure will arise). i don't have internet that's why i respond that slow

ERA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top