{% set_client_permission %}

Defines whether the client has granted or denied permission for a particular feature (eg: sessions). The only permission defined by default is the session permission (configurable in the site properties). However, the template developer may use this mechanism for any of their own purposes as well.

The permissions defined by this tag will be stored in the cookie, and thus may be read and/or modified by client-side javascript.


{% set_client_permission [allow|deny|1|0] [name] [renew] [with:value] [always | for duration | until date] %}

Allow and 1 are equivalent, as are deny and 0. If omitted, will default to allow.

If name is omitted, it will default to "session".

If name starts with '&', it will be treated as a reference variable, which will be dereferenced to the permission that will actually be set.

If this permission has already been allowed or denied, the original permission expires date will only be updated if "renew" is specified.

Value may be a variable or a string and will be evaluated stored along with the permission regardless of whether the permission was allowed or denied.

If specifying the expiration using "always", a far-future expiration date will be used (50 years in the future).

If specifying the expiration using "for", the duration must evaluate to a number followed by minutes, hours, days, weeks, months, or years.

If specifying the expiration using "until", the date must evaluate to an expiration date. If the expiration date is in the past, the permission will automatically be denied as expired.

If no expiration date is specified, the permission will default to 1 year in the future.

Remember that the expiration date specified here is for the permission, not for the effects of the permission. In the case of sessions, the expiration date defines how long the user has granted permission to have a session, regardless of the number or duration of sessions during that timeframe.

Permissions will never "expire" in the middle of a session - if a permission would be set to expire in the middle of a session, it will automatically be extended until the end of the session to prevent odd mid-session permission change bugs.


{% if request.query_params.allow_session == "true" %}
    {% var allow_length = "1 year" %}
    {% if request.query_params.allow_months %}
        {% set allow_length = request.query_params.allow_months | append: " months" %}
    {% endif %}
    {% set_client_permission allow session renew for allow_length %}
{% elsif request.query_params.deny_session == "true" %}
    {% set_client_permission deny renew %}
    --equivalent to {% set_client_permission deny session renew for 1 year %}
{% endif %}
{% if request.query_params.third_party_login %}
    {% if request.query_params.third_party_login == "false" %}
        {% set_client_permission deny ThirdPartyLogin %}
    {% else %}
        {% set_client_permission allow ThirdPartyLogin with:request.query_params.third_party_login %}
    {% endif %}
{% endif %}
{% if request.query_params.allow_networks %}
    {% var networks = request.query_params.allow_networks | split: ',' %}
    {% for network in networks %}
        {% set_client_permission allow &network %}
    {% endfor %}
{% endif %}

{% if request.query_params.deny_networks %}
    {% var networks = request.query_params.allow_networks | split: ',' %}
    {% for network in networks %}
        {% set_client_permission deny &network %}
    {% endfor %}
{% endif %}

Developer Overview

Liquid Markup