Setting up security is a little complicated. If you’re not careful, you can lock yourself out of your application or make your application’s menu disappear. This section describes some of the security mistakes we’ve seen and how to recover if the same mistakes happen to you.
Tip: Security mistakes usually happen while a developer is getting to know VPM Enterprise and before she has read the Security chapter. It’s not a good idea to “experiment” with VPM’s security features until you know how they work.
Tools Control Table
First, you need to know about an application’s tools control table – SVPMAdminTools2.DBF in the application’s \DATA directory. The SVPMAdminTools2 table contains a record for each tool listed on an application’s Admin Tools dialog (see Admin Tools Selection). Each record in this table contains a numeric field called “nStatus” that determines whether a tool is on or off. The SVPMAdminTools2 table and its nStatus field are your keys to recovering from security mistakes. Generally, the key to recovering from a security mistake is to
· Open the application’s SVPMAdminTools2 table in Visual FoxPro, and
· Turn User Access Security off by setting the nStatus field of the “SEC_SYSTEM” record to 0 (zero).
Now, let’s look at some of the mistakes to avoid and how to recover from them.
You Forget Your User ID and Password
You’ve set up a User on the Users form. You’ve turned on User Access Security. You forget the User ID and Password, and you haven’t written them down. You’re locked out of your application:
Recovery: Turn off User Access Security through the SVPMAdminTools2 table. Enter your application. Go to the Passwords form on the Admin – Security menu. Write down your User ID and Password. Turn on User Access Security again if you like through the Admin Tools dialog on the Admin – Security menu.
You Turn on Access Levels Security for Another User before Giving Yourself an “A” Access Level
You’ve set up a user on the Users form and given the user an “A” Access Level. Access Level Security is now on. Your Access Level is still blank. You can’t access the Users or Passwords forms.
Recovery: If you or the user with the “A” Access Level can enter the application with that user’s ID and password, you can go to your User record and give yourself an “A” Access Level. That solves the problem.
If for some reason you or the user can’t enter the application with the user’s ID and password to correct the problem, your recovery is a little painful. First, you must turn off User Access Security through the SVPMAdminTools2 table. Then, open the application’s User table SDATAUsers.DBF in Visual FoxPro and ZAP it. Of course, you’ll now have to reenter all user data.
Password Access: A variation on this mistake would be to make the same kind of mistake with the Access check box on the Passwords form. The recovery approach would be basically the same.
You Turn on Menu Security before Assigning Menu Permissions
You turn on Menu Security before assigning Menu Permissions to yourself. The next time you enter your application, there’s no menu. The only way you can exit the application is with the infamous “three finger salute”.
Recovery: If you can enter the application with another ID and password that has access to the Users form, you can go to the Users form and assign Menu Permissions to yourself. That solves the problem.
If for some reason you can’t enter the application with an ID and password to correct the problem, you must turn off User Access Security or Menu Security through the SVPMAdminTools2 table. Set the nStatus field of the “SEC_MENU” record to 0 (zero). Then, enter the application and assign Menu Permissions to yourself.
No Exit Permission: A variation on this mistake is to forget to assign yourself or another user permission for the File menu Exit option. If you do that, the application window close box won’t work because it requires the File – Exit menu option to function. The recovery approach would be basically the same.
Word to the Wise
If you just read the “Security Mistakes” section of this chapter because you started at the beginning of the Security chapter and read each section in turn, we commend you. You’re going to do very well with VPM Enterprise.
However, if you’re sitting there locked out of your application with perspiration dripping from your forehead, and this is the first time you’ve seen the “Security Mistakes” section, we hope you’ve learned your lesson.