Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Button handy
blanktrue
color#0052CC
nameSend Feedback
linkhttps://docs.google.com/forms/d/e/1FAIpQLScmToBe3vynAlb5fdKwCGxYqnTbDc66sIBgeecG2BuFDuHc7g/viewform?entry.2002826954=Writing+Security+Scripts+-+15482042
widthauto

Security scripts are SIL scripts that return a specific format - a boolean array of four values, each of them corresponding to a certain action (SET, INSERT, UPDATE, DELETE).

The basic syntax for a security script return 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 permission 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
languagejs
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};