• Модуль: ldap
  • Путь к файлу: ~/bitrix/modules/ldap/classes/general/ldap_util.php
  • Класс: CLdapUtil
  • Вызов: CLdapUtil::SetDepartmentHead
static function SetDepartmentHead($userId, $sectionId)
{
	//echo "Setting ".$userId." as head of ".$sectionId;

	$iblockId=COption::GetOptionInt("intranet","iblock_structure",false,false);

	if ($iblockId && $sectionId && $userId && CModule::IncludeModule('iblock'))
	{
		/*$perm = CIBlock::GetPermission($iblockId);
		if ($perm >= 'W')
		{*/
			$obS = new CIBlockSection();
			if ($obS->Update($sectionId, array('UF_HEAD' => $userId), false, false))
			{
				return true;
			}
			else //if ($obS->LAST_ERROR)
			{
				// update error
				return false;
			}
		/*}
		else
		{
			// access denied
			return false;
		}*/
	}
	else
	{
		// bad data
		return false;
	}
}