• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/rest/controllers/task/counters.php
  • Класс: BitrixTasksRestControllersTaskCounters
  • Вызов: Counters::checkGroupReadAccess
private function checkGroupReadAccess($groupId)
{
	if (!Loader::includeModule('socialnetwork'))
	{
		return false;
	}
	if ($groupId > 0)
	{
		// can we see all tasks in this group?
		$featurePerms = CSocNetFeaturesPerms::CurrentUserCanPerformOperation(
			SONET_ENTITY_GROUP,
			[$groupId],
			'tasks',
			'view_all'
		);

		$canViewGroup = is_array($featurePerms)
			&& isset($featurePerms[$groupId])
			&& $featurePerms[$groupId];

		if (!$canViewGroup)
		{
			// okay, can we see at least our own tasks in this group?
			$featurePerms = CSocNetFeaturesPerms::CurrentUserCanPerformOperation(
				SONET_ENTITY_GROUP,
				[$groupId],
				'tasks',
				'view'
			);
			$canViewGroup = is_array($featurePerms)
				&& isset($featurePerms[$groupId])
				&& $featurePerms[$groupId];
		}

		if (!$canViewGroup)
		{
			return false;
		}
	}

	return true;
}