K4:Ограничение доступа к шаблону
From In-Portal Developers Guide
(→m_CheckPermission: Translation) |
Current revision (04:17, 11 March 2009) (view source) (→m_RequireLogin: Translation) |
||
Line 36: | Line 36: | ||
== m_RequireLogin == | == m_RequireLogin == | ||
Данный тэг используется для создания шаблонов доступных к просмотру только пользователям, прошедшим идентификацию (logged in). Его также можно использовать для проверки прав доступа, принадлежности к группе и тому подобных вещей. Широкий спектр параметров делает его незаменимым в CMS системах. | Данный тэг используется для создания шаблонов доступных к просмотру только пользователям, прошедшим идентификацию (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. | ||
{| class="prettytable" | {| class="prettytable" | ||
- | ! | + | ! Parameter || Description |
|- | |- | ||
- | | {{ConfigProperty|no_permissions_template|string}} || | + | | {{ConfigProperty|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|login_template]], then the following template will be used: |
- | * | + | * in Admin Console - <code>no_permission.tpl</code>; |
- | * | + | * on Front-End - template name specified in Configuration [[K4:Configuration#NoPermissionTemplate|NoPermissionTemplate]]. |
- | {{InfoBox| | + | {{InfoBox|This tag also accepts ALL parameters that cab be specified for [[#m_CheckPermission|m_CheckPermission]] tag.}} |
|- | |- | ||
- | | {{ConfigProperty|condition|string}} || | + | | {{ConfigProperty|condition|string}} || Name of [[K4:Configuration|Configuration Variable]], which value will be checked. Exclamation mark ("<code>!</code>") can be put before the Variable name to use NOT logic, examples: |
- | * <code>SampleVariable</code> - | + | * <code>SampleVariable</code> - condition check will return TRUE if variable equals to "<code>1</code>"; |
- | * <code>!SampleVarible</code> - | + | * <code>!SampleVarible</code> - condition check will return TRUE if variable equals to "<code>0</code>". |
|- | |- | ||
- | | {{ConfigProperty|group|string}} || [[K4:PortalGroup#Name| | + | | {{ConfigProperty|group|string}} || Name of [[K4:PortalGroup#Name|User Group]] current user should belong to. |
|- | |- | ||
- | | {{ConfigProperty|pass_category|bool}} || | + | | {{ConfigProperty|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. |
|- | |- | ||
- | | {{ConfigProperty|no_group_perm_template|string}} || | + | | {{ConfigProperty|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. |
|- | |- | ||
- | | {{ConfigProperty|login_template|string}} || | + | | {{ConfigProperty|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: |
* [[#no_permissions_template|no_permissions_template]]; | * [[#no_permissions_template|no_permissions_template]]; | ||
* [[#no_group_perm_template|no_group_perm_template]]. | * [[#no_group_perm_template|no_group_perm_template]]. | ||
|} | |} |
Current revision
| ||
---|---|---|
Статьи в этой категории | ||
|
Для ограничения доступа к шаблону используются тэги 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:
To list multiple permissions as one group use comma ("
| ||||||||||
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:
| ||
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:
| ||
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: |