Event handlers (IRPCEventHandlersAdmin)
Reads and replaces the event handlers of a vault or of the server: VBScript code that the server runs when an event occurs.
MFAdmin uses this interface to admininistrate event handlers.
| gRPC service | MFiles.IRPCEventHandlersAdmin |
|---|---|
| Book and level | Administration API, specialized |
| Methods | 4 |
| Proto file | mfiles/IRPCEventHandlersAdmin.proto |
Overview
M-Files Admin uses this service for its event handler editor, and vault applications use it to
register their own handlers. An event handler is an
InternalEventHandler: the event it reacts to
(event_type), its position among the handlers of the same event (sort_index), is_active, a
description, and the code that the server runs.
- Vault event handlers run in one vault: GetVaultEventHandlers, SetVaultEventHandlers. They need a vault session.
- Server event handlers are stored once for the whole server: GetServerEventHandlers, SetServerEventHandlers. A server-level session is enough.
The Set methods replace the whole list: read it, change it, and write all handlers back. To
keep a handler, send it back with its guid; a handler left out is removed.
Rights. Handler code runs on the server, so writing it needs the right to run code there:
- Server right
run_code(messageServerAccess). Logins with the system administrator server role have it. Users with full control of the vault have it only when the server is configured to let vault administrators run code. Without it, writing fails with "Editing vault application bindings or VBScript code requires system administrator rights.". - When the server is configured to accept signed scripts, a vault administrator can write vault
event handlers without
run_code: each new or changedcodemust then carry a valid digital signature, and the caller needs the vault rightrun_signed_code(part of full control). - Reading vault handlers, including their code, needs only the vault right
change_metadata_structure. Reading server handlers needsrun_code.
Methods
| Method | Summary | Facts |
|---|---|---|
| GetServerEventHandlers | Gets all server-level event handlers, with their code. | admin session idempotent |
| GetVaultEventHandlers | Gets all event handlers of the vault, with their code. | admin session idempotent |
| SetServerEventHandlers | Replaces all server-level event handlers with the given list. | admin session idempotent |
| SetVaultEventHandlers | Replaces all event handlers of the vault with the given list. | admin session idempotent |