Task::getLegacyRightsChecker

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. getLegacyRightsChecker
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/runtime/task.php
  • Класс: BitrixTasksInternalsRunTimeTask
  • Вызов: Task::getLegacyRightsChecker
static function getLegacyRightsChecker(array $parameters)
{
	$result = array();

	$parameters = static::checkParameters($parameters);

	if (!BitrixTasksUtilUser::isSuper($parameters['USER_ID']))
	{
		list($conditions, $expression) = CTasks::getPermissionFilterConditions($parameters, array('USE_PLACEHOLDERS' => true));

		$conditions = "(case when (".implode(' OR ', $conditions).") then '1' else '0' end)";
		array_unshift($expression, $conditions);

		$query = new BitrixMainEntityQuery('Bitrix\Tasks\Task');
		$query->registerRuntimeField('F', array(
			'data_type' => 'string',
			'expression' => $expression
		));
		$query->setFilter(array('=F' => '1'));
		$query->setSelect(array('TASK_ID' => 'ID'));

		//print_r($query->getQuery());

		$rf = $parameters['REF_FIELD'];
		$result[] = new EntityReferenceField(
			$parameters['NAME'],
			BitrixMainEntityBase::getInstanceByQuery($query),
			array(
				'=this.'.((string) $rf != '' ? $rf : 'ID') => 'ref.TASK_ID'
			),
			array('join_type' => 'inner')
		);
	}

	return $result;
}

Добавить комментарий