Skip to content

Controller

setVerificationChain()

setVerificationChain() — returns void

Available in: controller Category: Configuration Functions

Use this function if you need a more low level way of setting the entire verification chain for a controller.

NameTypeRequiredDefaultDescription
chainarrayyes—An array of structs, each of which represent an argumentCollection that get passed to the verifies function. This should represent the entire verification chain that you want to use for this controller.
// 1. Set the entire verification chain directly using an array of structs
setVerificationChain([
	{only="handleForm", post=true},
	{only="edit", get=true, params="userId", paramsTypes="integer"},
	{only="delete", post=true, session="currentUser", handler="accessDenied"}
]);

// 2. Get the existing chain, modify it, and set it back
chain = verificationChain();
ArrayAppend(chain, {only="create,update", post=true});
setVerificationChain(chain);

// 3. Replace the chain built by a parent controller with a stricter one
setVerificationChain([
	{except="index,show", post=true, session="isAdmin", handler="requireAdmin"},
	{only="destroy", post=true}
]);