Delegated Administration: Hooks
If you're a user assigned the Delegated Admin - Administrator role, you can manage the different Hooks and queries that allow you to customize the behavior of the Delegated Administration extension.
To access the configuration area:
- Log in to the Delegated Administration Dashboard
- Click on your name in the top right corner. You'll see a drop-down menu; click on the Configure option.
The Configuration page to which you're redirected is where you can manage your Hooks and queries.
Hooks always have the following signature:
The context (ctx) object will expose a few helpers and information about the current request. The following methods and properties are available in every Hook:
- Custom Data
- Payload and Request
- Remote Calls
To add a message to the Webtask logs (which you can view using the Realtime Webtask Logs extension), call the log method:
To cache something (such as a long list of departments), you can store it on the context's global object. This object will be available until the Webtask container recycles.
You can store custom data within the extension. This field is limited to 400kb of data.
To read the data:
Payload and Request
Each Hook exposes the current payload or request with specific information. The request will always contain information about the user that is logged into the Users Dashboard:
If you want to call an external service (such as an API) to validate data or to load memberships, you can do this using the
The Hook contract:
ctx: The context object
payload: The payload object
action: The current action (for example,
delete:user) that is being executed
user: The user on which the action is being executed
callback(error): The callback to which you can return an error if access is denied
Example: Kelly manages the Finance department, and she should only be able to access users within her department.
If this hook is not configured, all users will be accessible.
Supported action names:
The following Hooks are available for use with your Delegated Administration extension: