8782 - Union queries allow all data

This commit is contained in:
Eric Espie
2026-02-18 09:54:37 +01:00
parent 3b62597092
commit 0cfd5c044b
2 changed files with 10 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ class DBUnionSearch extends DBSearch
public function AllowAllData($bAllowAllData = true)
{
foreach ($this->aSearches as $oSearch) {
$oSearch->AllowAllData();
$oSearch->AllowAllData($bAllowAllData);
}
}

View File

@@ -694,6 +694,15 @@ class DBSearchTest extends ItopDataTestCase
$this->CheckNestedSearch($sNestedQuery, false);
}
public function testAllowAllDataOnUnions()
{
$oSearch = \DBObjectSearch::FromOQL('SELECT Server UNION SELECT VirtualMachine');
$oSearch->AllowAllData(false);
self::assertFalse($oSearch->IsAllDataAllowed(), 'DBUnionSearch AllowData value');
$oSearch->AllowAllData(true);
self::assertTrue($oSearch->IsAllDataAllowed(), 'DBUnionSearch AllowData value');
}
private function CheckNestedSearch($sQuery, $bAllowAllData)
{
$oNestedQuerySearch = \DBObjectSearch::FromOQL($sQuery);