Hooks for Control Tokens
Ownership of Control Tokens is defined by one of:
- Session ID
- Account ID
- Machine ID
- or, Custom
Where Custom is a user-provided hook, as described in this topic.
Your custom hook must have the name, ControlTokenIsOwnerHook.SRC. The module must be both script and steady-state compatible.
If present, VTScada will call the hook with the following supplied parameters. Your module may used any of these.
\ControlTokenIsOwnerHook(Record { As returned by AlarmManager.GetRecord() }, SessID { The current security session }, MachineID { Identifies the current machine }, MachID { The current machine ID }, Custom { A custom value that can be any of: - Invalid (default set by ControlTokenCustomFieldHook) - a parameter that you pass to the Control Token Manager, - the value you set for Custom in any of RequestToken, ReleaseToken, DenyTokenRequest and GrantTokenRequest, - the first valid value of SessionID, AccountID or MachineID });
The Custom parameter can be used as another identifier of the user but can also be used to compare against the Custom field of a Record or Token. It also provides a way to RPC (remote procedure call) information other than SessionID, AccountID and MachineID from the client to the server when determining token ownership.
The default value of Custom is set by another new hook, "ControlTokenCustomFieldHook", which accepts SessionID, AccountID and MachineID as its parameters. This is a script hook that does not need to be steady-state compatible.
ControlTokenCustomFieldHook(SessionID, AccountID, MachineID)
The purpose of ControlTokenCustomFieldHook is to provide more flexibility when creating custom ownership rules. The return value of ControlTokenCustomFieldHook is passed to ControlTokenIsOwnerHook (if no Custom parm is provided directly) and to the Custom field of record \ tokens in RequestToken, ReleaseToken, DenyTokenRequest and GrantTokenRequest. It also provides a way to RPC information other than SessionId, AccountID and MachineId from the client to the server when determining token ownership.