mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-23 02:19:07 +01:00
API: search method now return true attributes value as handle by LdapSaisie (instead of raw attributes's values)
This commit is contained in:
parent
60d67f3123
commit
f960b2d394
3 changed files with 25 additions and 8 deletions
|
@ -165,8 +165,6 @@
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>attributes</term>
|
<term>attributes</term>
|
||||||
<listitem><simpara>Liste des attributs supplémentaires que devra retourner la recherche.</simpara>
|
<listitem><simpara>Liste des attributs supplémentaires que devra retourner la recherche.</simpara>
|
||||||
<warning><simpara>Attention, ici ce sont les valeurs brutes des attributs qui seront retournées et
|
|
||||||
par forcément les valeurs telle que retournées habituellement.</simpara></warning>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
|
@ -168,19 +168,24 @@ class LSattribute extends LSlog_staticLoggerClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne la valeur d'affichage de l'attribut
|
* Return attribute's display value
|
||||||
|
*
|
||||||
|
* @param[in] $data mixed Custom attribute data (optional, default: current attribute data)
|
||||||
*
|
*
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
*
|
*
|
||||||
* @retval string La valeur d'affichage de l'attribut
|
* @retval mixed The display value of the attribute
|
||||||
*/
|
*/
|
||||||
public function getDisplayValue() {
|
public function getDisplayValue($data=false) {
|
||||||
if (!$this -> ldap) {
|
if (!$this -> ldap) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this -> isUpdate()) {
|
if ($data !== false) {
|
||||||
|
$data = $this -> ldap -> getDisplayValue($data);
|
||||||
|
}
|
||||||
|
elseif ($this -> isUpdate()) {
|
||||||
$data = $this -> ldap -> getDisplayValue($this -> updateData);
|
$data = $this -> ldap -> getDisplayValue($this -> updateData);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1612,6 +1612,16 @@ function handle_api_LSobject_search($request) {
|
||||||
'objects' => array(),
|
'objects' => array(),
|
||||||
'total' => $search -> total,
|
'total' => $search -> total,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Instanciate LSform export to handle custom requested attributes
|
||||||
|
if (!LSsession :: loadLSclass('LSform'))
|
||||||
|
LSlog :: fatal("Fail to load LSform.");
|
||||||
|
$export = new LSform($object, 'export');
|
||||||
|
foreach ($search -> attributes as $attr) {
|
||||||
|
if (array_key_exists($attr, $object -> attrs))
|
||||||
|
$object -> attrs[$attr] -> addToExport($export);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$all) {
|
if (!$all) {
|
||||||
$data['page'] = $page['nb'];
|
$data['page'] = $page['nb'];
|
||||||
$data['nbPages'] = $page['nbPages'];
|
$data['nbPages'] = $page['nbPages'];
|
||||||
|
@ -1631,8 +1641,12 @@ function handle_api_LSobject_search($request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($search -> attributes as $attr) {
|
foreach ($search -> attributes as $attr) {
|
||||||
if (LSsession :: canAccess($LSobject, $obj -> dn, 'r', $attr))
|
if (!LSsession :: canAccess($LSobject, $obj -> dn, 'r', $attr))
|
||||||
$data['objects'][$obj -> dn][$attr] = $obj -> $attr;
|
continue;
|
||||||
|
$export -> elements[$attr] -> setValue(
|
||||||
|
$object -> attrs[$attr] -> getDisplayValue($obj -> $attr)
|
||||||
|
);
|
||||||
|
$data['objects'][$obj -> dn][$attr] = $export -> elements[$attr] -> getApiValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle as_list parameter
|
// Handle as_list parameter
|
||||||
|
|
Loading…
Reference in a new issue