Form-save triggers
Use the form-save
trigger type to create triggers that fire
when users send changed forms to the server. Form-save triggers are
called after the form has been parsed by the server but before the
changed form is stored in the
Helix Core Server
metadata.
Example
To prohibit certain users from modifying their client workspaces, add the users to a group called lockedws and use the following form-save trigger.
This trigger denies attempts to change client workspace specifications
for users in the lockedws
group, outputs an error message
containing the user name, IP address of the user’s workstation, and the
name of the workspace on which a modification was attempted, and
notifies an administrator.
#!/bin/bash NOAUTH=lockedws USERNAME=$1 WSNAME=$2 IPADDR=$3 GROUPS='p4 groups "$1"' if echo "$GROUPS" | grep -qs $NOAUTH then echo "$USERNAME ($IPADDR) in $NOAUTH may not change $WSNAME" mail -s "User $1 workspace mod denial" admin@127.0.0.1 exit 1 else exit 0 fi
This form-save
trigger fires on client
forms
only. To use the trigger, add the following line to the trigger
table:
sample6 form-save client "ws_lock.sh %user% %client% %clientip%"
Users whose names appear in the output of p4 groups
lockedws
have changes to their client workspaces parsed
by the server, and even if those changes are syntactically correct, the
attempted change to the workspace is denied, and an administrator is
notified of the attempt.