The client_permissions object is available on every page, and contains information about whether or not the user (or developer) has granted permission to use specific features. By default the only feature controlled by this is sessions, but the permission system may be "extended" arbitrarily by the developer to control additional features.
The permissions feature requires cookies in order to work. Requests made without cookies (such as by bots or browsers with cookies disabled) will always behave like an initial page-load without existing permission information.
| Name | Type | Description |
| is_valid | Boolean | Will always be true |
| cookiename | String | The name of the cookie used for storing permissions. Will always be "_mp_permissions" |
| has_cookie | Boolean | True if the permissions cookie was already set prior to this request. False on the first page load, after the client has cleared their cookies, or on all requests from browsers with cookies disabled |
| cookie_expires | time | The date and time that the permissions cookie is set to expire |
| min_permission_expiration_date | time | The next date and time that one of the permissions is set to expire. Note that this does not distinguish between "allow" and "deny" permissions and will ignore permissions with no expiration date set. If there are no permissions with expiration dates set this property will be empty |
| max_permission_expiration_date | time | The latest date and time that one of the permissions is set to expire. Note that this does not distinguish between "allow" and "deny" permissions and will ignore permissions with no expiration date set. If there are no permissions with expiration dates set this property will be empty |
| do_not_track | Boolean | Whether or not the browser sent the "DNT" header in the request |
| keys | list | The list of permissions (both allowed and denied) stored in the client_permissions object |
| * | permission | Specific permissions may be accessed using {{ client_permissions.permissionname }} or {{ client_permissions['permission-name'] }} |
| allow_* | Boolean | Shortcut to check if a specified permission is both defined AND allowed in the permission system. |
| output | String | JSON representation of the client_permissions object, similar to calling {{ client_permissions | inspect: 3, false }} |
The client_permissions object is copyable, and when copied using the {% copy_to_dictionary %} method the keys will be the permission names and the values will be the corresponding permission objects.
The client_permissions object may also be enumerated using the {% for %} method, which will loop through all of the related permission objects when the for loop is started. Permissions that are added during enumeration will NOT be included, permissions that are removed during enumeration WILL be included, and permission s that are modified during enumeration will be included along with their updated properties.
Defines whether the client has granted or deined 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 their own purposes as well.
The permissions defined by this method will be stored in the permissions cookie, which may be read and/or modified by client-side javascript.
If none of the expiration clauses are specified, the permission expiration date 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.
If the permission has a value, the value will be stored along with the permission regardless of whether the permission has been allowed or denied.
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.
Removes the specified permissions from the permissions cookie. Note that this is not the same as denying permission since there will be no record that permission was either granted or denied after the permission has been unset.
set_client_permission deny
Copyset_client_permission by reference
Copyset_client_permission third_party_login
CopyUnset Client Permissions by reference
CopyUnset Client Permissions
CopySome error message about failed confirmation and please try again
{% endif %}Safely Unset Client Permissions
CopyClient Permissions
CopyYou have requested that we do not track your information. We interpret that to mean __x__ and so will return a __y__ generic response.
{% else %} {% if client_permisions.allow_all %} --in this example "all" refers to a custom permission defined by the developerYou have granted us unlimited power! You should have the best possible experience.
{% if client_permissions.all.expires < request.date | add_weeks: 2 %}Your permissions will expire on {{ client_permission.all.expires | date: 'MMM dd' }}. If you want to continue receiving the best possible experience, follow these instructions
{% endif %} {% else %} {% if client_permissions.allow_generous %}You have allowed "generous" permissions. While not the best, this still allows for a good experience.
{% elsif client_permissions.allow_limited %}You have allowed "limited" permissions. This is only slightly better than a completely anonymous experience.
{% else %}You have not allowed any permissions. Your experience will be fully generic.
{% endif %}To customize your options and improve your experience, click here.
{% endif %} {% endif %}Client Permissions allow ads
Copy