I need to design a database where several people will work with. Good to have that security stuff and priviledge sets. But how can i bind layout elements to a certain privilege set so only users assigned to that privilege set are able to use it?
It depends what the layout items in question are, and it also depends on how you want users to interact with them.
If the items are fields, then you can control which fields users have access to via the Records>Custom Privileges... panel in the Privilege Sets tab of the Manage Security dialog.
If the items are buttons, you can place branching code (using an If[ ] ... EndIf sequence) in the script they call so they will be disabled (or perform a different function) depending on who is logged in. You can determine who the current user is within a calculation (inside your scripts' If[ ] step) by using functions such as Get(AccountName) and/or Get(AccountPrivilegeSetName).
And, of course, you can apply conditional formatting to objects to change their appearance according to who is logged in or any other criteria you choose.
Without knowing exactly what it is you want to achieve, it's hard to be more specific, but hopefully the above will give you some ideas to work with.
R J Cologon, Ph.D.
FileMaker Certified Developer
Author, FileMaker Pro 10 Bible
NightWing Enterprises, Melbourne, Australia
I do it a lot. For example I attach a script OnObjectEnter
I attached an example file I did for you. Try it as a Full Access account or as a Guest account using the relogin script.
Love & mercy,
privilegeField.fp7.zip 6.4 K
Generally i want to make one layout for all, where users can be Managers with more rights than Users with less rights.
I need to give more rights in two different ways:
a) managers must have access to layouts which will be opened by pressing buttons. So the complete functionaliy that layout offers will be available to managers only. I guess the solution from DD would fit right well into this. Maybe there are more ways to do this.
and b) there will be additional information on a layout which users must not be able to view, copy, edit. Some values are restricted so not managers should not even see, others are just protected to users so they shold not be able to modify. Specially here if so far have no idea how to solve this.
The third one i need is record bases, or lets say table based permissions, where some users should only read but not modify records. This i found can be done using custom record privileges in security.
Thanks for the sample script. I think this at least solves the part to secure layouts behind buttons. Very simple solution.
I just hope to find another solution which is more easy to maintain. Want to prevent me from editing to many scripts when something has to change in there. I get used to loose the overview of such scripts handling security stuff. The result one or more get easy forgotten change.
To the point about when items are buttons. I like the interaction of users with a layout in the way, items not available to them should be visible as such. Letting users interact with a item because it seems to be active and then telling them e.g. with a dialog, that they are not allowed to use it, is not very user friendly, and make them not likely to use it if it too often happens. That is my experience. What i wish is to be able to change states of items using scripts, like disabling a item so the user can see its not available, or even make it disappear.
But i couldn'd find any way to do this. Hopefully it will come in a future release.