Security Functions

elevate on
elevate off

When elevated, the script has access to everything in the system and permissions are not enforced. Please use with caution.

String SanitizeJS(String str)
Checks the string str to see if it contains any characters that may allow for script injection in Javascript. Throws an error if it does.

NoReturn security:VerifySignature(Path path)
Verifies the digital signature stored at the given path, checking that the data has not changed since it was signed, and that the signature is valid.

String security:SignRecord(Record node, String excludeFields)
Returns encrypted and signed data for the given record.

Boolean CheckPasswordStrength(String pass)
Validates the given password string, and returns True if the password meets the necessary strength (ISO PS008 compliant).

String str:ToBase64(String name)
Returns the base64 encoding for the given string (name).

String str:Encrypt(String name, String password)
Encrypts the given data using the given password.

String str:Decrypt(String name, String password)
Decrypts the given encrypted data using the given password.

String str:ToHMAC(String name, String key, String algo)
Returns an HMAC hash digest of the given data. Currently algo should be HMACSHA1.

String str:FromBase64(String name)
Decodes data from base64 encoding.

String CreateChecksum(Path path, Record node, String existingSig, String excludeFields)
Creates a checksum of the data (node) at path, supplying an existing checksum signature, and a list of fields to exclude (comma separated).

Boolean HasRole(String role)
Returns true if the current user has the given security role.

Record GetUser()
Returns the user record associated with the current user.

String UserRef()
Returns a link to the currently logged-in user.

String UserName()
Returns the User ID of the currently logged-in user.

List GetGoverningUsersFor(Path path)
Returns the governing users (as per the security workflow) for a given path, if any are defined.

List GetRoles()
Returns a list of the roles the user has.

Record domain:GetProperties(String domain, String domainAdminUser, String domainAdminPassword)
Retrieves the LDAP properties for the given domain, using the given domain admin user and password (or any account that has access to the domain properties).

Record domain:GetUserProperties(String domain, String user, String domainAdminUser, String domainAdminPassword)
Retrieves the LDAP properties for the given domain user, accessed using the given domain admin user and password (or any account that allows access to that user).

NoReturn domain:ChangePassword(String domain, String user, String oldPassword, String newPassword, String domainAdminUser, String domainAdminPassword)
Changes the password for a user on the given domain.

NoReturn domain:Update(String domain, String user, Record data, String domainAdmin, String domainPassword)
Updates the properties of a user record on a domain according to the values in data.

Record domain:GetUser(String domain, String user, String password, String domainAdminUser, String domainAdminPassword)
Authenticates then returns the user record on the given domain. If the user does not authenticate with the given password, then an error will be raised. To retrieve the error and process it, use [suppress errors] at the start of the line, and access the error in the #error variable. The given domainAdminUser is the account used to access the user's profile, alternatively this can just be the same user as specified in "user".

NoReturn domain:CreateUser(String domain, String user, String pass, Record data, String domainAdmin, String domainPassword)
Creates the given user (properties in data) on the given domain.

Boolean IsUserAdmin()
Returns true if the current user is an administrator.


Next Topic:
v4.2.0.956 (beta)
Up Since 2/29/2024 12:02:23 AM