- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter/processor/projectprocessor.php
- Класс: BitrixTasksInternalsCounterProcessorProjectProcessor
- Вызов: ProjectProcessor::getUserGroups
private function getUserGroups(int $userId): array
{
if (array_key_exists($userId, $this->userGroups))
{
return $this->userGroups[$userId];
}
$query = WorkgroupTable::query();
$query->setSelect(['ID']);
$query->registerRuntimeField(
new Reference(
'MY_PROJECT',
UserToGroupTable::class,
Join::on('this.ID', 'ref.GROUP_ID')
->where('ref.USER_ID', $userId)
->where(
'ref.ROLE',
'<=',
UserToGroupTable::ROLE_USER
),
["join_type" => "INNER"]
)
);
$projects = $query->exec()->fetchCollection();
$res = ProjectProvider::filterByFeatures($projects, ['tasks' => 'view_all'], $userId, $this->getSiteId());
$groupIds = [];
foreach ($res as $row)
{
$groupIds[] = (int)$row['ID'];
}
$this->userGroups[$userId] = $groupIds;
return $this->userGroups[$userId];
}