[turba] Personal addressbook editing problem

chris at wilber.me.uk chris at wilber.me.uk
Sun Apr 6 18:44:14 PDT 2003


Chuck,
We exchanged a couple of emails on Friday summarised briefly as:
If I create an address with cn John Smith, then subsequently edit this so that 
cn is now John R Smith this means that I can't add another address for John 
Smith.

I had a think and decided simplistically that the easiest way would be to look 
at the ldap.php file and see what goes on in there. I don't have access to diff 
at moment, so will send the entire file. The bit I changed is this, at the top 
of the setObject function.

        // Check if the attributes that make up the dn have changed
        $dn = $this->makeKey($attributes);
        //If they differ then add new ldap entry and delete old one
        if ($dn != $attributes['dn']){
            //Make sure that dn is changed in the attributes from old to new 
value
            $attributes['dn']=$dn;
            if ($this->addObject($attributes)){
                if ($this->removeObject($object_key, $object_id)){
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }


What I have done is checked to see what the dn would be for the new attributes. 
If this differs from the current dn then delete the current entry and re-add. 
Apparently there is no PHP function to do a direct modification of a dn.

Let me know if this is any use.

Thanks again for a great product.

On another point, I did think that it would be useful to have some indication 
which fields are mandatory, and to have the interface force entries for these. 
For example the issue with cn and sn being mandatory is not easily resolved 
except as you recommend by editing the schema. Is this covered in CVS version 
of Turba?

Regards
Chris Wilber

-------------------------------------------------
This mail sent through wilber.me.uk webmail
-------------- next part --------------



More information about the turba mailing list