API: add search parameters in return on LSobject search

This commit is contained in:
Benjamin Renard 2021-06-14 11:48:07 +02:00
parent 0360ab7951
commit 78de233321
2 changed files with 38 additions and 0 deletions

View file

@ -258,6 +258,27 @@
} }
}, },
"total": 14, "total": 14,
"params": {
"keepParamsBetweenSearches": false,
"filter": null,
"pattern": null,
"predefinedFilter": false,
"basedn": null,
"scope": null,
"sizelimit": 0,
"attronly": false,
"approx": false,
"recursive": true,
"attributes": [],
"onlyAccessible": true,
"sortDirection": null,
"sortBy": null,
"sortlimit": 0,
"displayFormat": "%{cn}",
"nbObjectsByPage": 25,
"withoutCache": false,
"extraDisplayedColumns": true
},
"page": 1, "page": 1,
"nbPages": 3 "nbPages": 3
}]]> }]]>

View file

@ -1621,8 +1621,25 @@ function handle_api_LSobject_search($request) {
'success' => true, 'success' => true,
'objects' => array(), 'objects' => array(),
'total' => $search -> total, 'total' => $search -> total,
'params' => array(
'keepParamsBetweenSearches' => $keepParamsBetweenSearches,
),
); );
// Export search parameters
$exportedParams = array(
'filter', 'pattern', 'predefinedFilter', 'basedn', 'scope', 'sizelimit', 'attronly',
'approx', 'recursive', 'attributes', 'onlyAccessible', 'sortDirection', 'sortBy', 'sortlimit',
'displayFormat', 'nbObjectsByPage', 'withoutCache', 'extraDisplayedColumns'
);
if (LSsession :: subDnIsEnabled())
$exportedParams = array_merge($exportedParams, array('displaySubDn', 'subDn'));
foreach ($exportedParams as $param) {
$data['params'][$param] = $search->getParam($param);
if ($param == 'filter' && $data['params'][$param])
$data['params'][$param] = $data['params'][$param] -> as_string();
}
// Instanciate LSform export to handle custom requested attributes // Instanciate LSform export to handle custom requested attributes
if (!LSsession :: loadLSclass('LSform')) if (!LSsession :: loadLSclass('LSform'))
LSlog :: fatal("Fail to load LSform."); LSlog :: fatal("Fail to load LSform.");