• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/provider.php
  • Класс: BitrixSocialnetworkLivefeedProvider
  • Вызов: Provider::getSonetGroupsAvailable
public function getSonetGroupsAvailable($feature = false, $operation = false): array
{
	global $USER;

	$result = [];

	$logRights = $this->getLogRights();
	if (
		!empty($logRights)
		&& is_array($logRights)
	)
	{
		foreach ($logRights as $groupCode)
		{
			if (preg_match('/^SG(d+)/', $groupCode, $matches))
			{
				$result[] = (int)$matches[1];
			}
		}
	}

	if (
		!empty($result)
		&& !!$feature
		&& !!$operation
	)
	{
		$activity = CSocNetFeatures::isActiveFeature(
			SONET_ENTITY_GROUP,
			$result,
			$feature
		);
		$availability = CSocNetFeaturesPerms::canPerformOperation(
			$USER->getId(),
			SONET_ENTITY_GROUP,
			$result,
			$feature,
			$operation
		);
		foreach ($result as $key => $groupId)
		{
			if (
				!isset($activity[$groupId])
				|| !$activity[$groupId]
				|| !isset($availability[$groupId])
				|| !$availability[$groupId]
			)
			{
				unset($result[$key]);
			}
		}
	}
	$result = array_unique($result);

	return $result;
}