PDA

View Full Version : LDAP: importing contacts/groups


cookm
08-04-05, 11:51 PM
I found this thread here:

http://www.dotproject.net/index.php?name=PNphpBB2&file=viewtopic&t=2087&highlight=contacts+ldap

Does anyone know if any progress has been made on the ability to import users from LDAP? (Can't post in the beta forum :) )

Edit: Erps. Found it!

cookm
09-04-05, 12:17 AM
However!

It seems the ldap queries are slightly wrong, several fields are pulling the wrong info (contact_type, contact_company, etc). Going to hack around on it today and see if I can fix it.

Edit: It seems that if a field is blank, it uses the last valid value.

cookm
09-04-05, 08:04 AM
Ok, found the fix.

Basically, the variable $var wasn't getting reset at the end of the loop


Just replace this:

for ($i = 0; $i<$info["count"]; $i++) {
$pairs = array();
print "<tr>\n";
foreach ($sql_ldap_mapping as $ldap_name => $sql_name) {
if(isset($info[$i][$ldap_name][0])){
$val = clean_value($info[$i][$ldap_name][0]);
}
if(isset($val)){


With this:

for ($i = 0; $i<$info["count"]; $i++) {
$pairs = array();
print "<tr>\n";
foreach ($sql_ldap_mapping as $ldap_name => $sql_name) {
$val = "";
if(isset($info[$i][$ldap_name][0])){
$val = clean_value($info[$i][$ldap_name][0]);
}
if(isset($val)){



under modules/system/contacts_ldap.php

ajdonnison
09-04-05, 09:37 AM
This is now fixed in the CVS and will be available in the 2.0.1 release that should be out within 24 hours.

cookm
09-04-05, 03:02 PM
I've found a couple of extra things (the import doesn't pull the right attributetype for a few fields). I'll document it up shortly and post it.

Karen
09-04-05, 03:21 PM
Could you put it in the Bugs & Suggestions - Mantis database - rather than as a post on the forums so that we can track it. Thanks

cookm
09-04-05, 03:26 PM
Fields with the wrong attributetype:

"location" => "contact_city",

should be

"l"=>"contact_city";

and

"companyname" => "contact_company",

should be

"company" => "contact_company",

in modules/system/contacts_ldap.php

That's it!

Edit: will post to Mantis, thanks Karen

BlackStar
03-05-05, 10:17 PM
Hello,

I would like to narrow down a little the importing of contacts in dotproject through ldap.
Because i am not quite proficient with the raw querying of Active Directory, I've tried to create a custom query through the Active Directory Users and Computers interface, i got the querie and then paste it at the contacts import of dotproject, but I had no luck.
Does anyone knows if we are able to use custom queries for importing contacts ?
For example i don't want to import users that do not have an email address, a first and last name. (Such as the system accounts created by AD by default).

Thank you in advance,

George Simos