In-Portal Developers Guide

This is a wiki-based Developers Guide for In-Portal Open Source CMS. The purpose of this guide is to provide advanced users, web developers and programmers with documentation on how to expand, customize and improve the functionality and the code the In-Portal software. Please consider contributing to our documentation writing effort.

K4:Ограничение доступа к шаблону

From In-Portal Developers Guide

Jump to: navigation, search
Работа с шаблонами Работа с шаблонами
Статьи в этой категории

Для ограничения доступа к шаблону используются тэги m_CheckPermission и m_RequireLogin.

m_CheckPermission

This tag is used to check permissions to access information on the template. In case if we need to limit the access to the entire template then m_RequireLogin tag should be used instead.

Below is a list of accepted parameters:

Parameter Description
perm_event (string) Event Name for which permissions will be checked. Event Name should be specified in the following format "prefix_special:EventName", example "u:OnCreate".
perm_prefix (string) Prefix of the object which Primary Section will be used to check the permissions. For example, Link (prefix "l") or Product (prefix "p") is located inside particular section. Note that Section used to be called Category before In-Portal v5.0.0.
permissions (string) Permission(s) Name that will be checked. For better results Permissions can be grouped together:
  • permissions in the same group are checked based on AND logic;
  • permissions between two separate groups are checked based on OR logic.

To list multiple permissions as one group use comma (","). To list multiple groups use pipe ("|"). Below are few examples for grouping permissions:

Permissions Result
А,B|C,D,E (А AND B) OR (C AND D AND E)
A,B A AND B
A|B,E A OR (B AND E)
A|B|D A OR B OR D
system (bool) Indicates that we check System Permissions - NOT dependent or related to the current Section. Note that Section used to be called Category before In-Portal v5.0.0.

m_RequireLogin

Данный тэг используется для создания шаблонов доступных к просмотру только пользователям, прошедшим идентификацию (logged in). Его также можно использовать для проверки прав доступа, принадлежности к группе и тому подобных вещей. Широкий спектр параметров делает его незаменимым в CMS системах.

Current tag is mainly used to check whether use is Logged In or not. It also can be used to check if user belongs to any specific User Group. Tag accepts wide range of parameters and can be successfully used in other tasks.

Parameter Description
no_permissions_template (string) Template Name where user will be redirected if NO rights to access returned. In case if this parameter is not specified as well as login_template, then the following template will be used:
  • in Admin Console - no_permission.tpl;
  • on Front-End - template name specified in Configuration NoPermissionTemplate.
Image:Infobox Icon.gif This tag also accepts ALL parameters that cab be specified for m_CheckPermission tag.
condition (string) Name of Configuration Variable, which value will be checked. Exclamation mark ("!") can be put before the Variable name to use NOT logic, examples:
  • SampleVariable - condition check will return TRUE if variable equals to "1";
  • !SampleVarible - condition check will return TRUE if variable equals to "0".
group (string) Name of User Group current user should belong to.
pass_category (bool) Whether to pass through or not the current Section when Permissions check fails (returned FALSE) and user will be redirected to "no permissions" template.
no_group_perm_template (string) In case if user successfully passed Logged In check, however does NOT belong to a specified User Group, then redirect user to specified in this parameter template.
login_template (string) In case if user did NOT pass Logged In check, then redirect user to specified in this parameter template. Specified template will be also used if any of below listed parameters are left empty: