• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/rest.php
  • Класс: CSocNetLogRestService
  • Вызов: CSocNetLogRestService::updateGroupSubject
static function updateGroupSubject($fields)
{
	foreach ($fields as $key => $value)
	{
		if (in_array(mb_substr($key, 0, 1), [ '~', '=' ]))
		{
			unset($fields[$key]);
		}
	}

	$subjectId = $fields['SUBJECT_ID'] ?? null;
	unset($fields['SUBJECT_ID']);

	if ((int)$subjectId <= 0)
	{
		throw new ArgumentException('Wrong group subject ID');
	}

	$arFilter = [
		'ID' => $subjectId
	];

	$dbRes = CSocNetGroupSubject::getList(array(), $arFilter);

	if (!($arGroupSubject = $dbRes->fetch()))
	{
		throw new ObjectNotFoundException('Socialnetwork group subject not found');
	}

	if (!self::isCurrentUserAdmin())
	{
		throw new AccessDeniedException('User has no permissions to update group subject');
	}

	$res = CSocNetGroupSubject::update($arGroupSubject["ID"], $fields);
	if ((int)$res <= 0)
	{
		throw new SystemException('Cannot update group subject');
	}

	return $res;
}