DanBrill Posted August 7, 2003 Posted August 7, 2003 Hello, Sorry for the long setup, but here goes: I have a file called "Info" that has two layouts. One is called "General Info" and the other is called "Restricted Info". Users switch between the layouts by clicking buttons. When the user opens the Info file they have to log in using a custom log-in system that I've come up with. They enter a user name and password. The user name is stored as a global field, gUserName. gUserName then forms a relationship with a file called "Users." The Users file has a record for each system user. The Users file has a field that indicates if the user in question is allowed to access the Info file at all, and another that further indicates whether or not he or she is allowed to access the Restricted Info layout of the Info database. Within the Info file, when the user clicks the button to switch to the Restricted layout, a script is run which checks the User database to make sure that the user has permission to go to the Restricted Info layout. If they do, they go to the layout. If not, they are given a message that they don't have permission and need to see the database administrator. This all works fine. The problem comes when the user switches to Find mode. Suppose the user has permission for the file and for the Restricted Info layout. If they are in Find mode and are on the General Info layout, and then click the button to go to the Restricted Info layout, the script runs and they always get the message that they don't have permission to go the Restricted Info layout. The script works fine in Browse mode, but not in Find mode. Why? If I'm in Find mode is there a problem that the user name is stored as a global? What can I do to get around this? Thanks for any insight, Dan
-Queue- Posted August 7, 2003 Posted August 7, 2003 Relationships don't exist in Find mode. Store your related information in local globals before entering Find mode and use these values to test permissions.
DanBrill Posted August 7, 2003 Author Posted August 7, 2003 OK, solved my own problem. When I go into Find mode the Info file still has gUserName, but it doesn't know what record it is related to in the Users file. (I put a custom dialog box in the layout-changing script to display Users::UserName. This shows the user name when in Browse mode, but comes up empty when in Find mode.) So I created an additional global field in the Info database, gHasAccessToRestricted. When the Info database is first opened, I use SetField to set gHasAccessToRestricted = Users::HasAccessToRestricted. Then I changed the layout-changing script that checks whether the user has permission to view restricted data against gHasAccessToRestricted rather than Users::HasAccessToRestricted. This works because it doesn't depend on a relationship, but on an internal field. Thanks, Dan
DanBrill Posted August 7, 2003 Author Posted August 7, 2003 Thanks, Queue. Your post handn't shown up when I started answering my own question. But that's the conclusion I came to. Working great now. But a lot of tedious script changes to make.... Thanks, Dan
Recommended Posts
This topic is 7778 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now