How the hell do you write these? - These are written by choosing the Security type to be DYNAMIC - an editor will appear below, and you will be able to write your own script. The script type is always SIL for the security and it has to return something in the lines of: return {true, true, true, false};
Of course, this is just static values coming from the script, which can be accomplished better with the STATIC security option, but instead of true/false you can put any SIL code or variable that resolves to a boolean value.Security scripts are SIL scripts that return a specific format. The basic syntax for a security script is this:
Code Block |
---|
return {<SET true/false>, <INSERT true/false>, <UPDATE true/false>, <DELETE true/false>}; |
With the SIL scripts you can create complex permissions schemes based on groups, project roles, etc. In the example below only a member of the “data-managers” group has permission to edit the values in the database:
Code Block |
---|
|
boolean SET = true;
boolean INSERT = false;
boolean UPDATE = false;
boolean DELETE = false;
if(isUserInGroup("data-managers", currentUser())) {
INSERT = true;
UPDATE = true;
DELETE = true;
}
return {SET, INSERT, UPDATE, DELETE}; |