Unverified Commit 52964b2f authored by Cédric Anne's avatar Cédric Anne Committed by GitHub
Browse files

Do not show ancestors on entity search results (#8864)

* Do not show ancestors on entity search results

* Do not return entities ancestors in API results
parent f2ccd464
......@@ -1299,7 +1299,9 @@ abstract class API extends CommonGLPI {
}
// filter with entity
if ($item->isEntityAssign()
if ($item->getType() == 'Entity') {
$where.= " AND (" . getEntitiesRestrictRequest("", $itemtype::getTable()) . ")";
} else if ($item->isEntityAssign()
// some CommonDBChild classes may not have entities_id fields and isEntityAssign still return true (like ITILTemplateMandatoryField)
&& array_key_exists('entities_id', $item->fields)) {
$where.= " AND (". getEntitiesRestrictRequest("",
......
......@@ -657,7 +657,7 @@ class Search {
}
if ($data['itemtype'] == 'Entity') {
$COMMONWHERE .= getEntitiesRestrictRequest($LINK, $itemtable, 'id', '', true);
$COMMONWHERE .= getEntitiesRestrictRequest($LINK, $itemtable);
} else if (isset($CFG_GLPI["union_search_type"][$data['itemtype']])) {
// Will be replace below in Union/Recursivity Hack
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment