• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/rest.php
  • Класс: CSocNetLogRestService
  • Вызов: CSocNetLogRestService::addGroupSubject
static function addGroupSubject($fields): array
{
	if (!self::isCurrentUserAdmin())
	{
		throw new AccessDeniedException('User has no permissions to add group subject');
	}

	foreach ($fields as $key => $value)
	{
		if (in_array(mb_substr($key, 0, 1), [ '~', '=' ]))
		{
			unset($fields[$key]);
		}
	}

	if (empty($fields['SITE_ID']))
	{
		$fields['SITE_ID'] = [ CSite::getDefSite() ];
	}

	$result = (int)CSocNetGroupSubject::add($fields);

	if (!$result)
	{
		throw new SystemException('Socialnetwork group subject hasn't been added');
	}

	return [
		'SUBJECT_ID' => $result,
	];
}