dupondje / PHP-Push-2

Z-Push Fork With CalDAV/LDAP Support
GNU Affero General Public License v3.0
67 stars 24 forks source link

LDAP_BASE_DNS variable #13

Closed fortiko closed 12 years ago

fortiko commented 12 years ago

Can you please give me an example of how to specify the LDAP_BASE_DNS correctly in config.php to get at least basic LDAP testing going?

I already fixed the login as per the other issue

Now the search/stat/getmessage relies on LDAP_BASE_DNS which I cannot seem to figure out how to specify.

Thanks!

dupondje commented 12 years ago

the BASE_DNS should be something like

array('ou=mail,dc=php-push,dc=com', 'ou=mail,dc=php-push2,dc=com'); 1 value is enough :)

fortiko commented 12 years ago

I declared the variable like so in config.php:

define('LDAP_BASE_DNS', array('ou=public,ou=abook,dc=domain,dc=tld'));

but then I get:

PHP-Push-2/backend/combined/config.php:142 Use of undefined constant LDAP_BASE_DNS - assumed 'LDAP_BASE_DNS' (8)

when I use the "standard" way of mapping variables in combined/config.php:

            'LDAP_SERVER' => LDAP_SERVER,
            'LDAP_BASE_DNS' =>  array('ou=public,ou=abook,dc=domain,dc=tld'),

When I declare the array inside combined/config.php

 public static $BackendLDAP_config = array(
            'LDAP_SERVER' => LDAP_SERVER,
            'LDAP_PORT' => LDAP_PORT,
            'LDAP_DEFAULT_COUNTRY' => LDAP_DEFAULT_COUNTRY,
            'LDAP_USER_DN' =>  LDAP_USER_DN,
            'LDAP_BASE_DNS' =>  array(ou=public,ou=abook,dc=domain,dc=tld'),
            'LDAP_PUBLIC_CONTACTS' => LDAP_PUBLIC_CONTACTS,
            'LDAP_PRIVATE_CONTACTS' => LDAP_PRIVATE_CONTACTS,
            'LDAP_NEW_CONTACT_FOLDER' => LDAP_NEW_CONTACT_FOLDER,
            );

no error occurs. Should we move all backend settings from config.php to combined/config.php?

dupondje commented 12 years ago

It should be in combined/config.php indeed!

fortiko commented 12 years ago

With this definition:

public static $BackendLDAP_config = array( 'LDAP_BASE_DNS' => array(ou=public,ou=abook,dc=domain,dc=tld'),

I still get this error:

PHP-Push-2/backend/ldap.php:124 Invalid argument supplied for foreach() (2)

dupondje commented 12 years ago

array('ou=public,ou=abook,dc=domain,dc=tld'), Seems like you forgot a ' :)

fortiko commented 12 years ago

Come on Jean-Louis, is this small-issues back-and-forth really constructive in your eyes?

OF COURSE I have a correct value with a tick (there was a copy&paste accident), otherwise PHP would have issued a parse error and not a semantic error such as

PHP-Push-2/backend/ldap.php:124 Invalid argument supplied for foreach() (2)

fortiko commented 12 years ago

The error of course persists...

fortiko commented 12 years ago

What does not work (in combined/config.php):

'LDAP_BASE_DNS' => serialize(array('ou=public,ou=rcabook,dc=qustodium,dc=net')),

Neither does: 'LDAP_BASE_DNS' => array('ou=public,ou=rcabook,dc=qustodium,dc=net'),

Both give: backend/ldap.php:125 Invalid argument supplied for foreach() (2)

What DOES work is using the same array definition in ldap.php directly:

// was // $base_dns = LDAP_BASE_DNS; $base_dns = array('cn=%u,ou=private,ou=rcabook,dc=qustodium,dc=net');