[Kolab-devel] [PATCH] Fix for kolab webclient metoo function on forwarding

Dan Ohnesorg Dan at ohnesorg.cz
Mon Dec 1 18:57:36 CET 2003


Dne Mon, Dec 01, 2003 at 12:36:30PM +0100, Jan Schneider napsal:

> > I have just found, that I am not able to send meeting request - there is
> > not
> > default account set and moment needs them.
> 
> That's right, you need to create an identity first. If user information is
> stored on the Kolab server, this could be done automagically by a hook on
> first time login.

I dont like this idea too match. If You will copy the setting, any change
made over kolab admin interface won't be reflected in the user identity.

I have seen, that someone had alerady solved a part of the prefs storage. I
have made the same, just enabling LDAP works and stores the preferencies.
Yes you need extend LDAP, but its the LDAP nature, be so extended to hold
any info about user on one place for all the systems (and make replicas to
prevent data loss and better performance).

You will only go into problem by users, which don't have needed objectClass,
so I have patched ldap.php to check it and if needed extend the user to
hordePerson, so the saving sucess. This should be probably part od horde,
not part of kolab, because any ldap backend will have problem with user,
which don't have proper object class.

The patch is here:

*** ldap.php.orig	Thu Oct  2 11:22:25 2003
--- ldap.php	Mon Dec  1 18:12:06 2003
***************
*** 510,515 ****
--- 510,546 ----
              }
          }
  
+ 		/* OK we will set preferences, but can we? = check object types */
+ 		$attrib = array('objectclass');
+ 		$search = ldap_search($this->connection, $this->params['basedn'],
+                               $this->params['uid'] . '=' . $this->user,$attrib);
+         if ($search) {
+             $result = ldap_get_entries($this->connection, $search);
+         } else {
+             Horde::logMessage('Failed to connect to LDAP preferences server.', __FILE__, __LINE__);
+         }
+         $top = 0;
+         $hordeperson = 0;
+         /* I hope the uid is unique */
+         if ($result) {
+         	for ($i=0; $i<$result[0]['objectclass']["count"]; $i++) {
+         		if (strcasecmp($result[0]["objectclass"][$i],'top') == 0)
+         			$top = 1;
+           		if (strcasecmp($result[0]["objectclass"][$i],'hordeperson') == 0)
+         			$hordeperson = 1;
+    		    }
+         }
+         /* in case that account hasn't needed object type -> add them */
+         if ($top == 0) {
+         	$add['objectclass'] = 'top';
+         	ldap_mod_add($this->connection, $this->dn, $add);
+         }
+ 
+         if ($hordeperson == 0) {
+         	$add['objectclass'] = 'hordePerson';
+         	ldap_mod_add($this->connection, $this->dn, $add);
+         }
+         
          /* Send the hash to the LDAP server. */
          if (ldap_mod_replace($this->connection, $this->dn, $new_values)) {
              foreach ($dirty_prefs as $pref) {


You can also made the user direct with top and hordePerson, but some users
will never use webclient.

cheers
dan




More information about the devel mailing list