|sinon_interdire_acces

The filter |sinon_interdire_acces allows to redirect to an error page if it is applied to a variable equal to false. This filter is often applied to the result of a #AUTORISER [1], it can be inserted anywhere in the template, even in inclusions.

The following code will redirect to a standard error page (by default on a 403 in the private area and 404 in the public area) if the user does not have webmaster rights.

[(#AUTORISER{webmestre}|sinon_interdire_acces)]

Instead of simply redirecting the user to a standard error page, you can fill in a redirection URL as the first parameter, and specify the error code as the second parameter.

The following example checks that the visitor correctly identified, otherwise a 403 error will be returned.

[(#SESSION{id_auteur}|sinon_interdire_acces{'',403})]

Note: if you wish to use another error code than 301 or 302, you should not specify a redirection URL.

See also

Other test filters

logical filters

Footnotes

[1See the description of the tag #AUTORISER and the corresponding API.

Author jack Published : Updated : 11/04/26

Translations : English, français, Nederlands, Português