[turba] Extend LDAP-example (was: turba, ldap and activesync)

Michael J Rubinsky mrubinsk at horde.org
Tue Feb 7 15:19:22 UTC 2012


Quoting Hanns Mattes <hanns at hannsmattes.de>:

> Hi,
>
> I'm extending the provided example for a personal ldap-addressbook (and
> try to keep it "activesyncable"). I've added some attributes and
> changed some mappings:
>
> ,----[ from backends.local.php ]
> | $_ldap_uid = $GLOBALS['registry']->getAuth();
> | $_ldap_basedn = 'dc=example,dc=com';
> | // get the domain-part
> | $trenner = explode("@", $_ldap_uid);
> | $_ldap_domain = $trenner[1];
> | $cfgSources['personal_ldap'] = array(
> |     // Disabled by default
> |     'disabled' => false,
> |     'title' => _("Adressenverzeichnis"),
> |     'type' => 'ldap',
> |     'params' => array(
> |         'server' => 'ldap://ldap.example.com',
> |         'tls' => false,
> |         'root' => 'ou=' . $_ldap_uid . ',ou=horde_adressen,' .  
> $_ldap_basedn,
> |         'bind_dn' => 'uid=' . $_ldap_uid . ',ou=' . $_ldap_domain  
> . ',ou=virtualmail,' . $_ldap_basedn,
> |         'bind_password' =>  
> $GLOBALS['registry']->getAuthCredential('password'),
> |
> |         'dn' => array('uid'),
> |
> | // Added evolutionPerson to get attributes birthDate and spouseName
> |         'objectclass' => array('top',
> |                                'person',
> |                                'turbaContact',
> |                                'inetOrgPerson',
> |                                'calEntry',
> |                                'organizationalPerson',
> | 			       'evolutionPerson'),
> |         'scope' => 'sub',
> |         'charset' => 'utf-8',
> |         'version' => 3
> |     ),
> |     'map' => array(
> |         '__key' => 'dn',
> |         '__uid' => 'uid',
> |
> |         // From horde.schema:
> |         '__type' => 'turbaType',
> |         '__members' => 'turbaMembers',
> |
> |         'name' => 'cn',
> | //        'name' => array('fields' => array('firstname', 'lastname'),
> | //                       'format' => '%s %s'),
> | 	'firstname' => 'givenName',
> |         'lastname' => 'sn',
> |         'nickname' => 'displayName',
> |         'email' => 'mail',
> |         'title' => 'title',
> |         'company' => 'o',
> |         'office' => 'roomNumber',
> |         'department' => 'ou',
> |         'businessCategory' => 'businesscategory',
> | //        'workAddress' => 'postaladdress',
> |         'workPostalCode' => 'postalcode',
> | 	'workStreet' => 'street',
> | 	'workCity' => 'l',
> |         'workPhone' => 'telephonenumber',
> |         'fax' => 'facsimiletelephonenumber',
> |         'homeAddress' => 'homepostaladdress',
> |         'homePhone' => 'homephone',
> |         'cellPhone' => 'mobile',
> | //      Abuse seeAlso to populate imaddress
> | 	'imaddress' => 'seeAlso',
> |         'notes' => 'description',
> | 	'category' => 'category',
> | 	// From evolutionPerson
> | 	'spouse' => 'spouseName',
> | 	'birthday' => 'birthDate',
> | 	'photo' => 'photo',
> |         // Evolution interopt attributes: (those that do not require the
> |         // evolution.schema)
> |         'website' => 'labeledURI',
> |
> |         // These are not stored on the LDAP server.
> |         'pgpPublicKey' => 'object_pgppublickey',
> |         'smimePublicKey' => 'object_smimepublickey',
> |
> |         // From rfc2739.schema:
> |         'freebusyUrl' => 'calFBURL',
> |     ),
> |
> |     'tabs' => array(
> |         _("Personal") => array('firstname', 'lastname',
> |                                'name', 'alias',
> |                                'birthday', 'spouse'),
> |         _("Location") => array('homeAddress', 'workStreet', 'workPOBox',
> |                                'workCity', 'workProvince',  
> 'workPostalCode',
> |                                'workCountry', 'workAddress', 'timezone'),
> |         _("Communications") => array('email', 'homePhone', 'workPhone',
> |                                      'cellPhone', 'fax', 'imaddress'),
> |         _("Organization") => array('title', 'role', 'company',  
> 'department'),
> |         _("Other") => array('category', 'photo', 'notes',  
> 'website', 'freebusyUrl',
> |                             'pgpPublicKey', 'smimePublicKey'),
> |     ),
> |
> |
> |     'search' => array(
> |         'name',
> |         'email',
> |         'businessCategory',
> |         'title',
> |         'homePhone',
> |         'workPhone',
> |         'cellPhone',
> |         'homeAddress'
> |     ),
> |     'strict' => array(
> |         'dn',
> |     ),
> |     'approximate' => array(
> |         'cn',
> |     ),
> |     'export' => true,
> |     'browse' => true,
> | );
> `----
>
> So far - without extensive testing - it's working for me. But I do have
> to enter name Information twice:
>
>         'name' => 'cn',
>         'lastname' => 'sn',
>
> 'cn' is necessary, though identical to 'sn' in my configuration. If I do
> something like
>
>        'name' => array('fields' => array('firstname', 'lastname'),
>                       'format' => '%s %s'),
>
> 'name' is constructed in the desired way, but I don't know, how to pass it
> to the 'cn'-attribute.
>
> Any advice?

IIRC, one of the parameters for composite fields specifies the backend  
field to store the value in. Don't have the code in front of me to  
tell you the name of the field, but if you read the documentation at  
the top of the file, it's there.

-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6096 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.horde.org/archives/turba/attachments/20120207/1f30974f/attachment.bin>


More information about the turba mailing list