Views: 6332
Last Modified: 10.10.2012

The used in the system mechanism of controlling users access permissions can be utilized in the following purposes:

  • for menu items show managing:

    Editing menu in the advanced mode you can use a condition with the type For user group to manage menu items show:

  • for menu template managing:

    The level of user access permissions can impact menu structure, set of used in menu elements or images, and etc. An example of access permissions verification that can be used for menu template is given below.

    <?
    …
       if ($PERMISSION > "D")
    {
     $sMenuBody = '<tr><td colspan=2 background="/bitrix/templates/demo/images/l_menu_border.gif">
    <img src="/bitrix/templates/demo/images/1.gif" width="1" height="1"></td></tr><tr>'.$strDir.'
    <td valign="top"'.$strstyle.' width="100%"><a href="'.$LINK.'" class="'.$strtext.'">'.$TEXT.'
    </a></td></tr>';
    }
    else
    {
     $sMenuBody = '<td colspan=2 background="/bitrix/templates/demo/images/l_menu_border.gif">
    <img src="/bitrix/templates/demo/images/1.gif" width="1" height="1">
    </td></tr><tr>'.$strDir_d.'</td><td valign="top"'.$strstyle.' width="100%">
    <a href="'.$LINK.'" class='.$strtext.'>'.$TEXT.'</a></td></tr>';
    
    }
    ?>

    Important! Conditions implying monitoring of the variable $PERMISSION value can be utilized only for menu templates.

  • for site template managing:

    User access permissions can be used for defining conditions in which a site template will be applied to the site pages. For example:

    In the given example the Corporative template 1 will be applied to site pages if the current user belongs to the group Administrators or Partners.

    Examples of php-conditions:

    $USER->IsAuthorized()Checks, if the current user is authorized.
    $USER->IsAdmin()Checks, if the current user is the system administrator.
    in_array('5',$USER-> GetUserGroupArray())Checks, if the current user belongs to the specified group (in this case it must be group with ID=5).

  • for site template elements managing:

    Using of the mechanism of user permissions control allows to manage site template elements showing, shapes, colors and other attributes.

  • for site elements managing:

    Using of the mechanism of user permissions control allows to organize managing the site elements (e.g., pages, sections, forums, and etc.) by different users.



Courses developed by Bitrix24