Newbies obe1 Posted August 4, 2010 Newbies Posted August 4, 2010 I have a client solution made up of two databases. The first contains all the data tables and the second, called Interface, contains all the layouts. In the Interface I have a series of seven layouts, each with seven buttons used to navigate between the layouts. There are three sets of users, the company owners, who have Full Access with full privileges, the production manager, whose privilege set is called Management, and artists who have no access to this part of the solution. Management can create, edit, and delete in all tables, view only layouts and value lists, and execute only all scripts. Each of the seven buttons is linked to a single script which validates which privilege set is being used and the additional parameter of each button (see sample below). Full Access users have no problem with any of the seven buttons, each takes the users to the appropriate layout. However, the production manager cannot access two of the layouts. When logged in using the Management privilege set the first and second buttons redirect her to the seventh layout. All of the remaining buttons work as scripted. If (Get(CurrentPrivilegeSetName) = "Management" or (Get(CurrentPrivilegeSetName) ="[Full Acess]" and Get (ScriptParameter) = "Comp List" Go to Layout ["Comp Shot List - Management" (Shots 2)] Else If [Get (CurrentPrivilegeSetName) = "Artist" Go to Layout ["Task List - Artists View V.2" (Assignments 2)] End If If (Get(CurrentPrivilegeSetName) = "Management" or (Get(CurrentPrivilegeSetName) ="[Full Acess]" and Get (ScriptParameter) = "Task Shot List" Go to Layout ["Task Assignment Shot List" (Shots 2)] Else If [Get (CurrentPrivilegeSetName) = "Artist" Go to Layout ["Task List - Artists View V.2" (Assignments 2)] End If The files are being served by FM Server 11 and all the users are using FileMaker 11. Thanks in advance.
Matthew F Posted August 5, 2010 Posted August 5, 2010 What does the your calculation yield for the Production manager? You can view the results by making a calculated field: Get(CurrentPrivilegeSetName) = "Management" or (Get(CurrentPrivilegeSetName) ="[Full Acess]" and Get (ScriptParameter) = "Comp List"
comment Posted August 5, 2010 Posted August 5, 2010 Two things to note: 1. AND is evaluated before OR. The expression: a or b and c is evaluated as: a or (b and c) Your first If[] will return True when Get(CurrentPrivilegeSetName) = "Management", without considering the script parameter. 2. When a script is set to run with full access privileges, Get(CurrentPrivilegeSetName) will return "[Full Access]" every time - that's why they added the Get (AccountPrivilegeSetName) function in version 11.
bruceR Posted August 5, 2010 Posted August 5, 2010 This is exactly why the new privilege set calcs were introduced. You're using the old ones; they never worked in full access scripts. You want Get(AccountPrivilegeSetName).
Newbies obe1 Posted August 5, 2010 Author Newbies Posted August 5, 2010 I have rewritten the If statement as follows: Get ( AccountPrivilegeSetName ) = "Management" and Get ( ScriptParameter ) = "Task Shot List" or Get ( AccountPrivilegeSetName ) = "[Full Access]" and Get ( ScriptParameter ) = "Task Shot List" It makes no difference. When the "Management" user clicks on that button it still takes her to the very last layout. And, again this behavior only occurs with the first two of seven buttons. The remaining five operate as scripted for her.
bruceR Posted August 6, 2010 Posted August 6, 2010 I have rewritten the If statement as follows: It makes no difference. When the "Management" user clicks on that button it still takes her to the very last layout. And, again this behavior only occurs with the first two of seven buttons. The remaining five operate as scripted for her. I don't know what you think that calc is supposed to do and it is pretty much impossible to tell. You've just thrown a big jumble together and I doubt very much that it does what you think it does. Put in parentheses where the real groups are supposed to be. I suspect you intend this: ( Get ( AccountPrivilegeSetName ) = "Management" and Get ( ScriptParameter ) = "Task Shot List") or (Get ( AccountPrivilegeSetName ) = "[Full Access]" and Get ( ScriptParameter ) = "Task Shot List") But that is not what you wrote. What you wrote will *evaluate* like this: (Get ( AccountPrivilegeSetName ) = "Management" ) and (Get ( ScriptParameter ) = "Task Shot List" or Get ( AccountPrivilegeSetName ) = "[Full Access]") and (Get ( ScriptParameter ) = "Task Shot List")
comment Posted August 6, 2010 Posted August 6, 2010 When the "Management" user clicks on that button it still takes her to the very last layout. I am not sure what the rest of your script is doing. I'd suggest you use the script debugger to see what's happening, or make a new script for testing: If [ Get (AccountPrivilegeSetName) = "Management" and Get (ScriptParameter) = "Task Shot List" or Get (AccountPrivilegeSetName) = "[Full Access]" and Get (ScriptParameter) = "Task Shot List"] Show Custom Dialog [ "True" ] Else Show Custom Dialog [ "False" ] End If BTW, your statement could be written more concisely as: ( Get (AccountPrivilegeSetName) = "Management" or Get (AccountPrivilegeSetName) = "[Full Access]" ) and Get (ScriptParameter) = "Task Shot List"
comment Posted August 6, 2010 Posted August 6, 2010 What you wrote will *evaluate* like this: (Get ( AccountPrivilegeSetName ) = "Management" ) and (Get ( ScriptParameter ) = "Task Shot List" or Get ( AccountPrivilegeSetName ) = "[Full Access]") and (Get ( ScriptParameter ) = "Task Shot List") I don't think so: as I mentioned earlier, AND is evaluated before OR - and there is no need for parentheses when you are not changing the default order of evaluation.
Recommended Posts
This topic is 5224 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