Get ( AccountName ) will return the name of the user's account--such as Admin.
Get ( AccountPrivilegeSetName ) will return [Full Access] (brackets included) if the person has the database open with full access privileges.
So if i was to write this in a script... What would it look like. Sorry dude im a noob! Thanks for your help.
You'd use one or the other in an If script step. Using the second get function:
If [ Get ( AccountPrivilegeSetName ) = "[Full Access]" ]
// put any script steps that you want to take place when the button is clicked and they have full access here
This assumes you have FileMaker 11, as this was a new function added with that release. If you are using an older version, you'd use Get ( PrivilegeSetName) instead.
You can also use conditional formatting to specify a grey text color when the current user is not a full access user so that the button looks "disabled".
Use this expression for a "formula" conditional format:
Get ( AccountPrivilegeSetName ) ≠ "[Full Access]"
And specify a dark grey text color instead of black.
Ok i did all that and it works great however, if you pick the layout from the layout list above ....you can still get to it. How do i resolve that?
Use Manage Layouts to clear the check box that includes this layout in the drop down list available while you are in browse mode or go to the layout and use Layout Setup... to clear the same check box.
You can also use settings in Manage Security so that the entire layout is grayed out for users that aren't full access just in case they find a way around all this and get to this layout anyway.
Additionally, I add a gatekeeper section to the script so that when the button is clicked by non-Admin users they get a dialog telling them as much, as follows (assumes admin users are in the "Admin" privilege set...):
If [Get ( CurrentPrivilegeSetName ) ≠ "Admin"]
Show Custom Dialog ["Not an Admin"; "It appears you are not an admin user..."]
I utilize only the Default Button in the dialog, so if they get into the If stmt by being non-Admin, then the Halt Script will hit after they click the button in the dialog, and the Halt step stops the script from running.
With that If section up top in a script, normal users won't get past the gatekeeper.