Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
143 lines (127 sloc) 5.22 KB
// ----------------------------------
// ADDRESSBOOK SETTINGS
// ----------------------------------
// This indicates which type of address book to use. Possible choises:
// 'sql' (default), 'ldap' and ''.
// If set to 'ldap' then it will look at using the first writable LDAP
// address book as the primary address book and it will not display the
// SQL address book in the 'Address Book' view.
// If set to '' then no address book will be displayed or only the
// addressbook which is created by a plugin (like CardDAV).
//$config['address_book_type'] = 'sql';
// In order to enable public ldap search, configure an array like the Verisign
// example further below. if you would like to test, simply uncomment the example.
// Array key must contain only safe characters, ie. a-zA-Z0-9_
// If you are going to use LDAP for individual address books, you will need to
// set 'user_specific' to true and use the variables to generate the appropriate DNs to access it.
//
// The recommended directory structure for LDAP is to store all the address book entries
// under the users main entry, e.g.:
//
// o=root
// ou=people
// uid=user@domain
// mail=contact@contactdomain
//
// So the base_dn would be uid=%fu,ou=people,o=root
// The bind_dn would be the same as based_dn or some super user login.
{
use NethServer::SSSD;
our $sssd = new NethServer::SSSD();
our $host = $sssd->host();
our $ldapURI = $sssd->ldapURI();
our $port = $sssd->port();
our $usetls = 'false';
our $bindDN = $sssd->bindDN();
our $bindPass = $sssd->bindPassword();
our $userDN = $sssd->userDN();
our $quotedBindPass = $bindPass; $quotedBindPass =~ s/\'/\\'/g;
if($sssd->startTls()) {
$usetls = 'true';
}
$OUT .= <<EOF;
\$config['ldap_public']['public'] = array(
'name' => 'Public LDAP Addressbook',
'hosts' => array('$ldapURI'),
'port' => $port,
'use_tls' => $usetls,
'user_specific' => false,
'base_dn' => '$userDN',
'bind_dn' => '$bindDN',
'bind_pass' => '$quotedBindPass',
'scope' => 'sub',
'referrals' => 0,
EOF
if ($sssd->isLdap()) {
$OUT .= <<EOD;
'filter' => '(objectClass=inetOrgPerson)',
'search_fields' => array('mail','cn'),
'fuzzy_search' => true,
'groups' => array(
'base_dn' => '',
'filter' => '(objectClass=posixGroup)',
'object_classes' => array("top", "posixGroup"),
'member_attr' => 'uid',
),
'fieldmap' => array(
'name' => 'cn',
'surname' => 'sn',
'firstname' => 'givenName',
'jobtitle' => 'title',
'email' => 'mail:*',
'locality' => 'l',
'organization' => 'o',
'department' => 'ou',
'phone' => 'telephoneNumber',
'street' => 'street',
),
EOD
}
if ($sssd->isAD()) {
$OUT .= <<EOL;
'filter' => '(&(objectClass=user)(objectCategory=person)(!(isCriticalSystemObject=TRUE)))',
'search_fields' => array('mail', 'cn', 'sAMAccountName', 'displayname', 'sn', 'givenName', 'userPrincipalName'),
'fuzzy_search' => true,
'sort' => 'cn',
'fieldmap' => array(
'name' => 'displayName',
'title' => 'title',
'email:account' => 'userPrincipalName',
'email:extra' => 'mail:*',
'phone:work' => 'telephoneNumber',
'phone:mobile' => 'mobile',
'phone:workfax' => 'facsimileTelephoneNumber',
'street' => 'street',
'zipcode' => 'postalCode',
'locality' => 'l',
'department' => 'departmentNumber',
'notes' => 'description',
'photo' => 'jpegPhoto',
),
EOL
}
$OUT .= "); // end of 'public' addressbook definition";
}
// An ordered array of the ids of the addressbooks that should be searched
// when populating address autocomplete fields server-side. ex: array('sql','Verisign');
$config['autocomplete_addressbooks'] = array('sql','public');
// The minimum number of characters required to be typed in an autocomplete field
// before address books will be searched. Most useful for LDAP directories that
// may need to do lengthy results building given overly-broad searches
$config['autocomplete_min_length'] = 1;
// Number of parallel autocomplete requests.
// If there's more than one address book, n parallel (async) requests will be created,
// where each request will search in one address book. By default (0), all address
// books are searched in one request.
$config['autocomplete_threads'] = 0;
// Max. numer of entries in autocomplete popup. Default: 15.
$config['autocomplete_max'] = 15;
// show address fields in this order
// available placeholders: \{street\}, \{locality\}, \{zipcode\}, \{country\}, \{region\}
$config['address_template'] = '\{street\}<br/>\{locality\} \{zipcode\}<br/>\{country\} \{region\}';
// Matching mode for addressbook search (including autocompletion)
// 0 - partial (*abc*), default
// 1 - strict (abc)
// 2 - prefix (abc*)
// Note: For LDAP sources fuzzy_search must be enabled to use 'partial' or 'prefix' mode
$config['addressbook_search_mode'] = 0;
You can’t perform that action at this time.