• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/socialnetwork/group.php
  • Класс: BitrixTasksIntegrationSocialNetworkGroup
  • Вызов: Group::canReadGroupTasks
static function canReadGroupTasks($userId, $groupId)
{
	static $access = [];

	if (
		array_key_exists($userId, $access)
		&& array_key_exists($groupId, $access[$userId])
	)
	{
		return $access[$userId][$groupId];
	}

	$activeFeatures = CSocNetFeatures::GetActiveFeaturesNames(SONET_ENTITY_GROUP, $groupId);
	if (!is_array($activeFeatures) || !array_key_exists('tasks', $activeFeatures))
	{
		$access[$userId][$groupId] = false;
		return $access[$userId][$groupId];
	}

	$featurePerms = CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, array($groupId), 'tasks', 'view_all');
	$bCanViewGroup = is_array($featurePerms) && isset($featurePerms[$groupId]) && $featurePerms[$groupId];
	if (!$bCanViewGroup)
	{
		$featurePerms = CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, array($groupId), 'tasks', 'view');
		$bCanViewGroup = is_array($featurePerms) && isset($featurePerms[$groupId]) && $featurePerms[$groupId];
	}

	$access[$userId][$groupId] = $bCanViewGroup;

	return $access[$userId][$groupId];
}