Scénarios d'utilisation
Scénarios d'authentification
Opérations CRUD basiques
Récupérer des données depuis LDAP
Example #1 Récupérer une entrée grâce à son DN
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local');
/*
$hm est un tableau à la structure suivante:
array(
'dn' => 'cn=Hugo Müller,ou=People,dc=my,dc=local',
'cn' => array('Hugo Müller'),
'sn' => array('Müller'),
'objectclass' => array('inetOrgPerson', 'top'),
...
)
*/
Example #2 Vérifier l'existence d'un DN donné
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local');
Example #3 Compter les enfants d'un DN donné
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local');
Example #4 Chercher dans l'arbre LDAP
span style="color: #808080; font-style: italic;">/* ... */'(objectclass=*)',
'ou=People,dc=my,dc=local'"dn"] . ': ' . $item['cn'
Ajouter des données à LDAP
Example #5 Ajouter une nouvelle entrée à LDAP
span style="color: #808080; font-style: italic;">/* ... */'cn', 'Hans Meier''sn', 'Meier''objectClass', 'inetOrgPerson');
$ldap->add('cn=Hans Meier,ou=People,dc=my,dc=local', $entry);
Supprimer de LDAP
Example #6 Supprimer une entrée existante de LDAP
span style="color: #808080; font-style: italic;">/* ... */'cn=Hans Meier,ou=People,dc=my,dc=local');
Mettre à jour LDAP
Example #7 Mettre à jour une entrée existante dans LDAP
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local''mail', 'mueller@my.local''newPa$$w0rd''cn=Hugo Müller,ou=People,dc=my,dc=local', $hm);
Opérations avancées
Copier et déplacer des entrées LDAP
Example #8 Copier une entrée LDAP récursivement avec tous ses descendants
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local',
'cn=Hans Meier,ou=People,dc=my,dc=local'
Example #9
Déplacer une entrée LDAP récursivement vers un sous-arbre différent
span style="color: #808080; font-style: italic;">/* ... */'cn=Hugo Müller,ou=People,dc=my,dc=local',
'ou=Dismissed,dc=my,dc=local'
|
|