Documentation

ChangePermission

void
CSearch::ChangePermission(
	string MODULE_ID,
	array arGroups,
	string ITEM_ID = false,
	string PARAM1 = false,
	string PARAM2 = false,
	string SITE_ID = false,
	string PARAMS = false
);

The method modifies access permissions to the indexed data of this module. Static method.

Method parameters

Parameter DescriptionAvailable from version
MODULE_ID Code of the module, access permissions to which must be modified.
arGroups Array of the group codes, that have access permissions to read the indexed data.
ITEM_ID Code of the element, access permissions to which must be modified. If this parameter equals false, then the element code limitation is not specified (element access permissions with any codes can be modified). Optional parameter, equals false by default.
PARAM1 First element parameter that limits the set of indexed elements, which access permissions must be modified. If this parameter equals false, then the limit by the first element parameter is not specified. Optional parameter, equals false by default.
PARAM2 Second element parameter that limits the set of indexed elements, which access permissions must be modified. If this parameter equals false, then the limit by the second element parameter is not specified. Optional parameter, equals false by default.
SITE_ID Site of the indexed element that limits the set of elements which access permissions must be modified. If this parameter equals false, then the limit by the second element parameter is not specified. Optional parameter, equals false by default.

Prior to version 4.0.6 this parameter was named LID.
PARAMS Optional parameter, equals false by default.

Examples of use

Modify the access permissions to the indexed post messages of this forum when modifying forum access permissions
<?
$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);
?>


© «Bitrix24», 2001-2024
Up