(Based on an email by Romain Strieff, dBVIPS, in the VdBASE newsgroups)
> Ya..I can easily restrict access
from within my program to check the
> security level, and restrictions can be made on a network level, but the
> users are wanting me to go the extra yard to assure that even if someone
> gains access to the file from s outside my program, that they couldn't
get
> into the data file to delete or modify records, etc.
If they don't have the masterpassword,
nor the supervisor one, that's exactly what will be the result. Not even if
they steal the file and take it home. If you want that security whichout login,
that's possible as well, see the boilerplate below.
Now let's assume you entered ROBERT,MAIN,TRUSTNO1 as name, group, password
In the beginning of your program(or QBE or whatever), where you open the first of your PROTECTed tables, use the following code:
cn="ROBERT"
cG="MAIN"
*-- make it more complicated than this so that it will not be visible when *--
_viewing_ the EXEin an Editor
cP="TRUSTNOTONEPERSON"
cP=left(cP,6)+"1"
If
Type("LockWindowUpdate") # "FP"
extern CLOGICAL
LockWindowUpdate(CHANDLE) User
EndIf
If Type("GetDeskTopWindow") #
"FP"
extern CHANDLE
GetDeskTopWindow ( CVOID ) USER
Endif
*--this will lock all windows
LockWindowUpdate(GetDeskTopWindow())
&& Freeze
*--put data to type
into the login dialog in the keyboard buffer keyboard
cn+chr(9)+cg+CHR(9)+Cp+CHR(13)
*--this will trigger the login screen which will
never appear because of
*--the locked windows and will be filled-in
completely automatically
USE MYTABLE
LockWindowUpdate(0) && Unfreeze the form