Code

Include personal title in cn/dn
[gosa.git] / plugins / personal / generic / class_user.inc
index 803f6ce5797cd70821a92a532c34a93efa4e7d69..46ecbc77d434db966131cb7fe6910dbc588d2228 100644 (file)
@@ -690,7 +690,10 @@ class user extends plugin
     plugin::save ();
 
     if ($this->use_dob == "1"){
-      $this->attrs['dateOfBirth']= date("Y-m-d", $this->attrs['dateOfBirth']);
+      /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
+      if(!is_array($this->attrs['dateOfBirth'])) {
+        $this->attrs['dateOfBirth']= date("Y-m-d", $this->attrs['dateOfBirth']);
+      }
     }
     /* Remove additional objectClasses */
     $tmp= array();
@@ -944,7 +947,7 @@ class user extends plugin
 
         /* Ok. User exists. Remove him/her when pw_storage has
            changed to be NOT kerberos. */
-        if ($this->pw_storage != "kerberos"){
+        if ($this->pw_storage != $this->config->current['KRBSASL']){
           $ret= kadm5_delete_principal ( $handle, $principal);
 
           if ($ret === FALSE){
@@ -954,8 +957,8 @@ class user extends plugin
 
       } else {
 
-        /* User doesn't exists, create it when pw_storage is kerberos. */
-        if ($this->pw_storage == "kerberos"){
+        /* User doesn't exists, create it when pw_storage is kerberos or SASL. */
+        if ($this->pw_storage == "kerberos" || $this->pw_storage == "sasl" ){
           $ret= kadm5_create_principal ( $handle, $principal);
 
           if ($ret === FALSE){
@@ -990,7 +993,12 @@ class user extends plugin
     $message= plugin::check();
 
     /* Assemble cn */
-    $this->cn= $this->givenName." ".$this->sn;
+    if ($this->personalTitle == ""){
+      $pt= "";
+    } else {
+      $pt= $this->personalTitle." ";
+    }
+    $this->cn= $pt.$this->givenName." ".$this->sn;
 
     /* Permissions for that base? */
     if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){