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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login / Password protect application

Status
Not open for further replies.

nallen

IS-IT--Management
Oct 20, 2003
10
US
I've searched the forum, but still couldn't really find what I'm looking for. I have a VFP 5.0 application. I now need some security for it - I need to have a general login form where the user then gets assigned to a group and where these groups then have access to certain forms, reports, etc. in the system. I think I can get away with restricting access to forms, etc. by actually just restricting access to menu items (what I mean is that I don't need to restrict down to the field level or anything).

In any case, I don't believe I have to reinvent the wheel. Is this code out there? If anyone could direct me to the source code or to some external program I can use, I would appreciate it.

THANKS!
 
There is nothing particularly difficult about a login form, it's just a modal form that looks up a user and password and assigned the group level, otherwise it returns .f. so the application can quit. The simple way to "work" the menu, is to put a SKIP FOR clause on each entry and tie it to the group level. If you want to delete the menu items, it's a bit more complicated, but remember the menu file is just another table!

Most frameworks include this kind of code, and for a simple example, check out the Tasmanian Traders Sample project, included VFP 5, 6, and 7. In 6 & 7 use:
Code:
MODIFY PROJECT (HOME(2) + 'tastrade\tastrade')
In 5.0 use:
Code:
MODIFY PROJECT (HOME() + 'samples\tastrade\tastrade')
Rick
 
Sounds like you just want to have a lookup table with user name, and user level and have different menus based on the user level which the logon form refers to.

To add some additional security, you could store some of the logic as outlined in faq184-4964.

Brian
 
nallen,

As Rick says, there's nothing special about a login form. It's just a mechanism for checking the a given user enters the correct password. You'll need a password table, which you use to check the entries against.

Restricting access to certain menu items is a slightly different issue. The easiest way to do that is to use the SKIP FOR clause in the menu code to grey out a menu if the current user is not allowed to use it. You'll need to store some sort of code which tells you which users can access which menus. You then test the current user against that code, and use the result of the test as the condition in your SKIP FOR.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top