bcooney Posted April 27, 2006 Posted April 27, 2006 Another post describes the simple technique of using Get (LayoutAccess)=0 to limit a user's navigation to a restricted layout. I cannot get this to work. My user ends up at a NO ACCESS gray screen. It's a simple script: go to layout "admin" (priv set "user" has no access) if (getlayoutaccess)=0 show message go to layout "main" else set window title, ... endif why isn't this working? It does not seem to be "dropping" into the show message steps.
CobaltSky Posted April 27, 2006 Posted April 27, 2006 Hello bcooney, A script with the sequence of commands you have outlined works corectly in every instance I have seen, provided the syntax at key points is correct. As you have posted it above, the syntax is wildly incorrect (a scripted If[ ] statement does not look like that and neither does the Get(LayoutAccess) command) - indeed if you were to try to enter the syntax as you've posted it into a script, FileMaker would throw an error message. So whatever your syntax is, it isn't what you've posted here. I suggest that you take a careful look over the syntax you've used in the script and see if you can spot anything irregular. If that doesn't point you to a solution, then I'd suggest that you create a new simple file and try to replicate the functionality there. If your test file still doesn't work, then zip up a copy of it and post it here as an attachment and I'm sure I or someone else here will be happy to take a look at it for you and tell you what is amiss. :)
bcooney Posted April 27, 2006 Author Posted April 27, 2006 Sorry, that was pseudo-FM scripting. I will try the suggestion of a simple demo file. If it works, I will post what I did incorrectly (perhaps it'll help someone). If it doesn't I'll post my original script.
bcooney Posted April 27, 2006 Author Posted April 27, 2006 (edited) Well the test database worked perfectly (figures!). For the life of me...here are the two scripts. [color:blue]Test Database If[ Get (ScriptParameter) = "Admin"] Go to Layout ["Admin" (Admin)] If [ Get (LayoutAcess)=0] Show Custom Dialog ["Access Denied"] Go to Layout ["Main Menu" (Main)] End If End If [color:blue]Real System If[ Get (ScriptParameter) = "Admin Menu"] Go to Layout ["Admin Menu" (MAIN_Main_Dev)] If [ Get (LayoutAcess)=0] Go to Layout ["Main Menu" (Main)] Show Custom Dialog ["Access Denied"] Else Set Window Title [Current Window, New Title: "Admin Menu"] End If End If Edit: I took out the Set Window Titles. Still not working. Also, I added a "Beep" just above the Custom Dialog and no beep plays..so I'm thinking that for some reason it's not falling into the Get (LayoutAccess)=0 branch. However,layout access must = 0 or I wouldn't get the Access Denied gray screen. I wish debugger worked in other priv sets! Edited April 27, 2006 by Guest
CobaltSky Posted April 27, 2006 Posted April 27, 2006 Hi, Interesting - but at least you now know that the technique is sound, and there is something particular to the way you have set up the script in your 'real' file that is preventing it from working. What that something is is not obvious from your posts - so I can only make an educated guess as to what the issue may be. If you have enabled the option to "Run script with full access privileges" in the script in your 'real' file, then at the point when the If[ ] test occurs during the course of the script, layout access will indeed be available, so Get(LayoutAccess) will not return a zero. Take a look at that and let us know if that is in fact the case - and if so, whether disabling that script option corrects the problem for you. :)
bcooney Posted April 27, 2006 Author Posted April 27, 2006 That was it! You're terrific! I took that specific nav out of my main Navigation script (bcs I'm hesitant to turn off Run w/Full--there's a lot more sub-scripts within this script) and moved it to its own script and voila!
Recommended Posts
This topic is 6784 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