privileged
The privileged
object contains utility methods to perform "do-as" operations in RESTApps.
Important Note! A RESTApp that wants to use the privileged utility must state usage of it in its manifest!
The require operation will return null for apps that hasn't explicitly stated the requirePrivileged
option.
Methods
privileged.isConfigured()
Returns true if there are a service user configured for usage for the app. Returns false if not.
privileged.getPrivilegedActionUser()
Gets the user the privileged action will run as. Will be null if isConfigured is false.
privileged.doPrivilegedAction(callback)
Executes a callback function as the privileged action user. Callback will be executed as current user if isConfigured is false.
Example
This example returns JSON information about current user outside and within the privileged mode.