OpenWGA 7.9 - TMLScript reference

WGA
Object:

WGA.Master

Description

Subobject "Master" provides utilities to run scripts under master rights.

A script running under master rights is not limited to the users rights on the used resources but rather has unlimited rights to create, modify or delete data. Master scripts may be used to allow the user to execute certain, well defined functionalities that exceed his normal user rights. They should therefor be used with care.

This functionalities may be seen as an alternative to using master actions which is a bit more flexible as it allows mixing of master and non-master functionalities in the same script.

The downside is that master scripts run in separate database sessions than the script that calls them. This means that after the master script has finished the calling script and the following WebTML code of the page will not be able to see modifications made under master rights. Ways to avoid this are to redirect the current request to another page via WGA.redirectTo() or to reopen the current database session after calling the master function. The latter can be done using WGA.reopenSessions().

Retrieval As global object "WGA.Master"
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Properties and methods
Name Purpose
runFunction([context,] function [, param1, param2, ...]) Runs a JavaScript function under master session rights
runMethod(object, function [, param1, param2 ...]) Runs the method of a custom TMLScript object under master session rights