diff options
Diffstat (limited to 'doc/es_ES/plugin-ldap-client.markdown')
-rw-r--r-- | doc/es_ES/plugin-ldap-client.markdown | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/doc/es_ES/plugin-ldap-client.markdown b/doc/es_ES/plugin-ldap-client.markdown new file mode 100644 index 00000000..1a34a880 --- /dev/null +++ b/doc/es_ES/plugin-ldap-client.markdown @@ -0,0 +1,99 @@ +Libreria LDAP +============ + +Para facilirar la integracion LDAP. kanboard tiene su propia libreria LDAP +Esta libreria puede ejecutar operaciones comunes. + +Cliente +------- + +Clase: `Kanboard\Core\Ldap\Client` + +Para conectar a tu servidor LDAP facilmente, usa este metodo: + +```php +use Kanboard\Core\Ldap\Client as LdapClient; +use Kanboard\Core\Ldap\ClientException as LdapException; + +try { + $client = LdapClient::connect(); + + // Get native LDAP resource + $resource = $client->getConnection(); + + // ... + +} catch (LdapException $e) { + // ... +} +``` + +Consultas LDAP +-------------- + +Classes: + +- `Kanboard\Core\Ldap\Query` +- `Kanboard\Core\Ldap\Entries` +- `Kanboard\Core\Ldap\Entry` + +Ejemplo para una consulta al directorio LDAP: + +```php + +$query = new Query($client) +$query->execute('ou=People,dc=kanboard,dc=local', 'uid=my_user', array('cn', 'mail')); + +if ($query->hasResult()) { + $entries = $query->getEntries(); // Return an instance of Entries +} +``` + +Leer una entrada: + +```php +$firstEntry = $query->getEntries()->getFirstEntry(); +$email = $firstEntry->getFirstValue('mail'); +$name = $firstEntry->getFirstValue('cn', 'Default Name'); +``` + +Leer multiples entradas: + +```php +foreach ($query->getEntries()->getAll() as $entry) { + $emails = $entry->getAll('mail'); // Fetch all emails + $dn = $entry->getDn(); // Get LDAP DN of this user + + // Check if a value is present for an attribute + if ($entry->hasValue('mail', 'user2@localhost')) { + // ... + } +} +``` + +Usuario Helper +-------------- + +Clase: `Kanboard\Core\Ldap\User` + +Obtener usuario en una sola linea + +```php +// Return an instance of LdapUserProvider +$user = User::getUser($client, 'my_username'); +``` + +Grupo Helper +------------ + +Clase: `Kanboard\Core\Ldap\Group` + +Obtener grupos en una linea: + +```php +// Define LDAP filter +$filter = '(&(objectClass=group)(sAMAccountName=My group*))'; + +// Return a list of LdapGroupProvider +$groups = Group::getGroups($client, $filter); +``` |