[horde] Sync only personal address book

Alexa Rodriguez avrodriguez at jusbaires.gov.ar
Mon Aug 9 21:46:29 UTC 2010


Jan Schneider <jan at horde.org> escribió:

> Zitat von Alexa Rodriguez <avrodriguez at jusbaires.gov.ar>:
>
>>
>> Jan Schneider <jan at horde.org> escribió:
>>
>>> Zitat von Alexa Rodriguez <avrodriguez at jusbaires.gov.ar>:
>>>
>>>> Hi,
>>>>
>>>> My users have two address books by defect:
>>>>
>>>> • Default => Personal
>>>> • Company's Name => contains data company's people
>>>>
>>>> For safety, I need that users can only to sync their address books.
>>>>
>>>> My question is: it's possible fix this in the turba's configuration?
>>>> if so which files should be modified?
>>>
>>> Lock the user preference for sync address books in turba/config/prefs.php.
>>>
>>> Jan.
>>
>> Thanks Jan.
>>
>> To confirm, this settings are correct?
>>
>> // Address books use for synchronization
>> $_prefs['sync_books'] = array(
>>    'value' => 'a:0:{}',
>>    'locked' => true,
>>    'shared' => false,
>>    'type' => 'multienum',
>>    'desc' => _("Select the address books that should be used for  
>> synchronization with external devices:"),
>
> This is the correct preference, but probably not the correct value.  
> You want to populate it with the user's personal address book. If  
> the personal address books are not using shares ('use_shares' =>  
> false in config/sources.php), you want to specify the source name,  
> e.g. 'localsql'. If you *are* using shares, you need to fill this  
> preference dynamically through a preference hook.
> Please note that this preference is a serialized PHP array.
>
> Jan.
>
Thanks Jan,

I tried do you said, but doesn't works.
I see in the horde.log, that Horde is searching in Ldap instead of  
Sql, here the log:

Aug 09 18:03:15 HORDE [debug]: [horde] Created device class  
SyncML_Device_Sync4j [pid 32179 on line 55 of  
"/usr/share/php/SyncML/Device.php"]
Aug 09 18:03:15 HORDE [debug]: [horde] Sending add from server: user  
[pid 32179 on line 485 of "/usr/share/php/SyncML/Sync.php"]
Aug 09 18:03:15 HORDE [debug]: [turba] LDAP query by  
Turba_Driver_ldap::_search(): user = usertest, root =  
ou=People,dc=example,dc=com (myldap.example.com); filter =  
"(&(uid=*user*))"; attributes = "dn, uid, displayName, sn, mail,  
street, telephonenumber, mobile, calFBURL"; deref = "0"  ; sizelim
it = 350 [pid 32179 on line 191 of "/horde/turba/lib/Driver/ldap.php"]

Config "prefs.php"

$prefGroups['addressbooks'] = array(
     'column' => _("Display Options"),
     'label' => _("Address Books"),
     'desc' => _("Choose which address books to use."),
     'members' => array('default_dir', 'addressbookselect', 'sync_books'),
);

$prefGroups['columns'] = array(
     'column' => _("Display Options"),
     'label' => _("Column Options"),
     'desc' => _("Select which fields to display in the address lists."),
     'members' => array('columnselect'),
);

$prefGroups['display'] = array(
     'column' => _("Display Options"),
     'label' => _("Display"),
     'desc' => _("Select view to display by default and paging options."),
     'members' => array('initial_page', 'maxpage', 'perpage'),
);

$prefGroups['format'] = array(
     'column' => _("Display Options"),
     'label' => _("Name Format"),
     'desc' => _("Select which format to display names."),
     'members' => array('name_format'),
);

$_prefs['addressbookselect'] = array(
     'locked' => true,
     'type' => 'special',
);

$_prefs['addressbooks'] = array(
     'value' => "localldap\nlocalsql",
     'locked' => true,
     'shared' => false,
     'type' => 'implicit',
);

$_prefs['sync_books'] = array(
     'value' => 'localsql',
     'locked' => true,
     'shared' => false,
     'type' => 'multienum',
     'desc' => _("Select the address books that should be used for  
synchronization with external devices:"),
);

$_prefs['columnselect'] = array(
     'locked' => false,
     'type' => 'special',
);

$_prefs['columns'] = array(
     'value' =>  
"localldap\temail\tworkPhone\tcellPhone\nlocalsql\tlastname\temail\tcompany",
     'locked' => false,
     'shared' => false,
     'type' => 'implicit',
);

$_prefs['sortorder'] = array(
     'value' =>  
'a:1:{i:0;a:2:{s:5:"field";s:8:"lastname";s:9:"ascending";b:1;}}',
     'locked' => false,
     'shared' => false,
     'type' => 'implicit',
);

$_prefs['maxpage'] = array(
     'value' => 10,
     'locked' => false,
     'shared' => false,
     'type' => 'number',
     'desc' => _("Maximum number of pages"),
);

$_prefs['perpage'] = array(
     'value' => 20,
     'locked' => false,
     'shared' => false,
     'type' => 'number',
     'desc' => _("Number of items per page"),
);

$_prefs['initial_page'] = array(
     'value' => 'search.php',
     'locked' => true,
     'shared' => false,
     'type' => 'enum',
     'desc' => _("View to display by default:"),
     'enum' => array('browse.php' => _("Address Book Listing"),
                     'search.php' => _("Search")),
);

$_prefs['name_format'] = array(
     'value' => 'first_last',
     'locked' => true,
     'shared' => false,
     'type' => 'enum',
     'desc' => _("Select the format used to display names:"),
     'enum' => array('last_first' => _("\"Lastname, Firstname\" (ie.  
Doe, John)"),
                     'first_last' => _("\"Firstname Lastname\"  (ie.  
John Doe)"),
                     'none' => _("no formatting")),
);


$_prefs['default_dir'] = array(
    // 'value' => '',
      'value' => 'localsql',
     'locked' => true,
     'shared' => false,
     'type' => 'select',
     'desc' => _("This will be the default address book when adding or  
importing contacts."),
);

$_prefs['prefbooks'] = array(
     'value' => '',
     'locked' => false,
     'shared' => false,
     'type' => 'implicit',
);

$_prefs['turba_maintenance_tasks'] = array(
     'value' => 'a:0:{}',
     'locked' => false,
     'shared' => false,
     'type' => 'implicit'
);

$_prefs['own_contact'] = array(
     // The format is 'source_name;contact_id'.
     'value' => '',
     'locked' => true,
     'shared' => false,
     'type' => 'implicit'
);


Config "sources.php"

  $cfgSources['localldap'] = array(
      'title' => _("Company"),
      'type' => 'ldap',
      'params' => array(
          'server' => 'myldap.example.com',
          'port' => 389,
          'tls' => false,
          'root' => 'ou=People,dc=example,dc=com',
          'bind_dn' => 'uid=egroup,ou=sec,dc=example,dc=com',
          'bind_password' => '*****',
          'sizelimit' => 350,
          'dn' => array('cn','sn'),
          'objectclass' => array('top',
                                 'person',
                                 'organizationalPerson',
                                 'calEntry',
                                 'posixAccount',
                                 'sambaSamAccount',
                                 'shadowAccount',
                                 'inetOrgPerson'),
          'scope' => 'one',
          'charset' => 'utf-8',
          'checkrequired' => false,
          'checkrequired_string' => ' ',
          'checksyntax' => false,
          'version' => 3
      ),
      'map' => array(
          '__key' => 'dn',
          '__uid' => 'uid',
          'name' => 'displayName',
          'lastname' =>    'sn',
          'email' =>       'mail',
          'workPhone' =>   'telephonenumber',
          'cellPhone' =>   'mobile',
          'freebusyUrl' => 'calFBURL'
      ),
      'search' => array(
          'name',
          'email',
      ),
      'strict' => array(
          'dn',
      ),
      'approximate' => array(
          'cn',
      ),
      'export' => false,
      'browse' => false,
  );


$cfgSources['localsql'] = array(
     'title' => _("Dir Personal"),
     'type' => 'sql',
     'params' => array_merge($GLOBALS['conf']['sql'], array('table' =>  
'turba_objects')),
     'map' => array(
         '__key' => 'object_id',
         '__owner' => 'owner_id',
         '__type' => 'object_type',
         '__members' => 'object_members',
         '__uid' => 'object_uid',
         'firstname' => 'object_firstname',
         'lastname' => 'object_lastname',
         'middlenames' => 'object_middlenames',
         'namePrefix' => 'object_nameprefix',
         'nameSuffix' => 'object_namesuffix',
         'name' => array('fields' => array('namePrefix', 'firstname',
                                           'middlenames', 'lastname',
                                           'nameSuffix'),
                         'format' => '%s %s %s %s %s',
                         'parse' => array(
                             array('fields' => array('firstname',  
'middlenames',
                                                     'lastname'),
                                   'format' => '%s %s %s'),
                             array('fields' => array('firstname', 'lastname'),
         'homeStreet' => 'object_homestreet',
         'homePOBox' => 'object_homepob',
         'homeCity' => 'object_homecity',
         'homeProvince' => 'object_homeprovince',
         'homePostalCode' => 'object_homepostalcode',
         'homeCountry' => 'object_homecountry',
         'workStreet' => 'object_workstreet',
         'workPOBox' => 'object_workpob',
         'workCity' => 'object_workcity',
         'workProvince' => 'object_workprovince',
         'workPostalCode' => 'object_workpostalcode',
         'workCountry' => 'object_workcountry',
         'timezone' => 'object_tz',
         'email' => 'object_email',
         'homePhone' => 'object_homephone',
         'workPhone' => 'object_workphone',
         'cellPhone' => 'object_cellphone',
         'fax' => 'object_fax',
         'pager' => 'object_pager',
         'title' => 'object_title',
         'role' => 'object_role',
         'company' => 'object_company',
         'category' => 'object_category',
         'notes' => 'object_notes',
         'website' => 'object_url',
         'freebusyUrl' => 'object_freebusyurl',
         'pgpPublicKey' => 'object_pgppublickey',
         'smimePublicKey' => 'object_smimepublickey',
     ),
     'tabs' => array(
         _("Personal") => array('firstname', 'lastname', 'middlenames',
                                'namePrefix', 'nameSuffix', 'name', 'alias',
                                'birthday', 'photo'),
         _("Location") => array('homeStreet', 'homePOBox', 'homeCity',
                                'homeProvince', 'homePostalCode',  
'homeCountry',
                                'workStreet', 'workPOBox', 'workCity',
                                'workProvince', 'workPostalCode',  
'workCountry',
                                'timezone'),
         _("Communications") => array('email', 'homePhone', 'workPhone',
                                      'cellPhone', 'fax', 'pager'),
         _("Organization") => array('title', 'role', 'company', 'logo'),
         _("Other") => array('category', 'notes', 'website', 'freebusyUrl',
                             'pgpPublicKey', 'smimePublicKey'),
     ),
     'search' => array(
         'name',
         'company',
         'email'
     ),
     'strict' => array(
         'object_id',
         'owner_id',
         'object_type',
     ),
     'export' => true,
     'browse' => true,
     'use_shares' => false,
     'list_name_field' => 'lastname',
     'alternative_name' => 'company',
);

> -- 
> Do you need professional PHP or Horde consulting?
> http://horde.org/consulting/
>
> -- 
> Horde mailing list - Join the hunt: http://horde.org/bounties/#horde
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>





More information about the horde mailing list