Bitrix Site Manager

CSearch::ChangePermission

void
ChangePermission(
 string MODULE_ID,
 array arGroups [,
 string ITEM_ID [,
 string PARAM1 [,
 string PARAM2 [,
 string LID]]]]
);

The function changes permissions to access the indexed information of the specified module.

Parameters

ParameterDescription
MODULE_ID The ID of the module permissions to elements of which are to be changed.
arGroups Array with user group ID's allowed to read the indexed information.
ITEM_ID The ID of an element permissions to which are to be changed. If set to false (default), the method changes permissions to any element.
PARAM1 Parameter of an element permissions to which are to be changed. Used to limit the range of affected elements. If set to false (default), the method affects all elements.
PARAM2 Same as PARAM1.
LID Site of an element. If set to false (default), the method affects elements in all sites.

Example

Change permissions to access the indexed posts of the forum.

<?
$Forum_ID = 5;
$arGroups = CForum::GetAccessPermissions($Forum_ID);
$arGPerm = Array();
for ($i=0; $i < count($arGroups); $i++)
{
    if ($arGroups[$i][1]>="E")
    {
        $arGPerm[] = $arGroups[$i][0];
        if ($arGroups[$i][0]==2)
            break;
    }
}
CSearch::ChangePermission("forum", $arGPerm, false, $Forum_ID);
?>