• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rightsmanager.php
  • Класс: BitrixDiskSimpleRightBuilder
  • Вызов: SimpleRightBuilder::fillTree
private function fillTree()
{
	if($this->hasAllTasksWithOperationRead())
	{
		$this->connection->queryExecute("
			INSERT INTO b_disk_simple_right (OBJECT_ID, ACCESS_CODE)
			SELECT DISTINCT pathchild.OBJECT_ID, r.ACCESS_CODE FROM b_disk_object_path path
			    INNER JOIN b_disk_right r ON r.OBJECT_ID = path.OBJECT_ID
			    INNER JOIN b_disk_object_path pathchild ON pathchild.PARENT_ID = r.OBJECT_ID
			WHERE path.PARENT_ID = {$this->objectId} AND r.NEGATIVE = 0
		");
	}
	else
	{
		$ids = array();
		foreach($this->getTasksWithOperationRead() as $task)
		{
			$ids[] = (int)$task['ID'];
		}
		unset($task);

		if(!$ids)
		{
			return $this;
		}

		$this->connection->queryExecute("
			INSERT INTO b_disk_simple_right (OBJECT_ID, ACCESS_CODE)
			SELECT DISTINCT pathchild.OBJECT_ID, r.ACCESS_CODE FROM b_disk_object_path path
			    INNER JOIN b_disk_right r ON r.OBJECT_ID = path.OBJECT_ID
			    INNER JOIN b_disk_object_path pathchild ON pathchild.PARENT_ID = r.OBJECT_ID
			WHERE path.PARENT_ID = {$this->objectId} AND r.NEGATIVE = 0 AND r.TASK_ID IN (" . implode(', ', $ids) .")
		");
	}

	return $this;
}