> I'm trying to use rcomplier so that it will connect to one database that
> contains user's access levels to different databases and then launch the
> correct database with a form that has menu options which may or may not
> appear based on the user's access level.
>
> What would be the best way to do this?
If one application is going to call the others, then probably the best way is
for the first application to write a small piece of code that the second
application will run at start up time.
For instance, if the master application will call a secondary application, that
secondary application could include, near the begining, the code:
SET VAR vInitFile = (ENVAL('TEMP') + '\AppInit.PRG')
IF CHKFILE(.vInitFile) = 0 THEN
PAUSE 2 USING 'Could not initialize application, you have lowest privileges.'
SET VAR vPrivLevel = 0
ELSE
RUN &vInitFile
ENDIF
Now, before the master application calls the secondary one it would do:
SET VAR vInitFile = (ENVAL('TEMP') + '\AppInit.PRG')
OUTPUT &vInitFile
SET VAR vCommand = ('SET VAR vPrivLevel =' & CTXT(.vUserPrivLevel))
WRITE .vCommand
WRITE 'PAUSE 2 USING ''Application Initialized!'''
WRITE 'RETURN'
OUTPUT SCREEN
-- Launch application here.
This way the master application specifies to the secondary one the allowed
level. If something goes wrong, or the secondary application is invoked
directly, the lowest privilege level is granted (or you could just refuse to
start the application). Users won't step on each other, since the information
is passed through the temporary directory which is (presumably) unique to each
user.
I've made some assumptions about what kind of information you want to pass
around and also left out a lot of error checking (it's not guaranteed, for
instance, that there is an environment variable named TEMP or that the location
it points to is valid) -- but hopefully the logic is clear.
--
Larry