mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
LSldapObject : Add except_current_object option on attribute validation test
This commit is contained in:
parent
5ec0f7d210
commit
f313b2e1d3
2 changed files with 23 additions and 2 deletions
|
@ -23,7 +23,8 @@
|
||||||
'object_type' => '[Type d'LSobject recherché]',
|
'object_type' => '[Type d'LSobject recherché]',
|
||||||
'basedn' => '[BaseDn de la recherche]',
|
'basedn' => '[BaseDn de la recherche]',
|
||||||
'scope' => '[Scope de la recherche]',
|
'scope' => '[Scope de la recherche]',
|
||||||
'result' => '[Résultat positif de la recherche]'
|
'result' => '[Résultat positif de la recherche]',
|
||||||
|
'except_current_object' => '[Exclure l'objet courant]'
|
||||||
),
|
),
|
||||||
...
|
...
|
||||||
),]]>
|
),]]>
|
||||||
|
@ -86,6 +87,15 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>except_current_object</term>
|
||||||
|
<listitem>
|
||||||
|
<simpara>Booléen définissant si l'objet courrant doit être exclu du résultat
|
||||||
|
de la recherche. Ce paramètre n'est évalué quand cas de création (formulaire
|
||||||
|
<literal>create</literal>).</simpara>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</sect4>
|
</sect4>
|
||||||
|
|
|
@ -494,7 +494,18 @@ class LSldapObject {
|
||||||
$sfilter=$sfilter_user;
|
$sfilter=$sfilter_user;
|
||||||
}
|
}
|
||||||
$sbasedn=(isset($test['basedn']))?getFData($test['basedn'],$this,'getValue'):NULL;
|
$sbasedn=(isset($test['basedn']))?getFData($test['basedn'],$this,'getValue'):NULL;
|
||||||
|
if (isset($test['except_current_object']) && (bool)$test['except_current_object'] && !$LSform -> idForm!='create') {
|
||||||
|
$sret=LSldap :: search ($sfilter,$sbasedn,$sparams);
|
||||||
|
$dn=$this->getDn();
|
||||||
|
$ret=0;
|
||||||
|
foreach($sret as $obj) {
|
||||||
|
if ($obj['dn']!=$dn)
|
||||||
|
$ret++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
$ret=LSldap :: getNumberResult ($sfilter,$sbasedn,$sparams);
|
$ret=LSldap :: getNumberResult ($sfilter,$sbasedn,$sparams);
|
||||||
|
}
|
||||||
if($test['result']==0) {
|
if($test['result']==0) {
|
||||||
if($ret!=0) {
|
if($ret!=0) {
|
||||||
if ($LSform) $LSform -> setElementError($attr,$msg_error);
|
if ($LSform) $LSform -> setElementError($attr,$msg_error);
|
||||||
|
|
Loading…
Reference in a new issue