Code

Fixed a couple of static/non-static error messages
[gosa.git] / plugins / personal / generic / class_user.inc
index c56ddfa7fdca1a01865c0514db03a4bb290af7a2..6437f1dd9452694874bc0cd197cce1aed39b6d9e 100644 (file)
@@ -23,7 +23,9 @@ class user extends plugin
 
   /* Plugin specific values */
   var $base= "";
+  var $orig_base= "";
   var $cn= "";
+  var $new_dn= "";
   var $personalTitle= "";
   var $academicTitle= "";
   var $homePostalAddress= "";
@@ -76,6 +78,7 @@ class user extends plugin
   var $role= "";
   var $publicVisible= "";
 
+  var $orig_dn;
   var $dialog;
 
   /* variables to trigger password changes */
@@ -83,10 +86,12 @@ class user extends plugin
   var $last_pw_storage= "unset";
   var $had_userCertificate= FALSE;
 
+  var $view_logged = FALSE;
+
   /* attribute list for save action */
   var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle",
-      "homePostalAddress", "homePhone", "labeledURI", "o", "ou", "dateOfBirth", "gender","preferredLanguage",
-      "departmentNumber", "employeeNumber", "employeeType", "l", "st",
+      "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "dateOfBirth", "gender","preferredLanguage",
+      "departmentNumber", "employeeNumber", "employeeType", "l", "st","jpegPhoto",
       "roomNumber", "telephoneNumber", "mobile", "pager", "cn", "userPKCS12",
       "postalAddress", "facsimileTelephoneNumber", "userSMIMECertificate");
 
@@ -100,11 +105,16 @@ class user extends plugin
       "functionalTitle", "certificateSerialNumber", "publicVisible", "street", "role",
       "postalCode");
 
+  var $multiple_support = TRUE;
+  var $multiple_support_active  = FALSE;
+  var $selected_edit_values  = array();
+  var $multiple_user_handles  = array();
 
   /* constructor, if 'dn' is set, the node loads the given
      'dn' from LDAP */
-  function user ($config, $dn= NULL)
+  function user (&$config, $dn= NULL)
   {
+
     $this->config= $config;
     /* Configuration is fine, allways */
     if ($this->config->current['GOVERNMENTMODE']){
@@ -114,6 +124,11 @@ class user extends plugin
     /* Load base attributes */
     plugin::plugin ($config, $dn);
 
+    $this->orig_dn  = $this->dn;
+    $this->new_dn   = $this->dn;
+
+    $this->new_dn = $dn;
+
     if ($this->config->current['GOVERNMENTMODE']){
       /* Fix public visible attribute if unset */
       if (!isset($this->attrs['publicVisible'])){
@@ -144,7 +159,7 @@ class user extends plugin
     }
 
     /* Load data from LDAP? */
-    if ($dn != NULL){
+    if ($dn !== NULL){
 
       /* Do base conversation */
       if ($this->dn == "new"){
@@ -173,8 +188,8 @@ class user extends plugin
       }
 
       /* Load extra attributes: certificate and picture */
-      $this->load_picture();
       $this->load_cert();
+      $this->load_picture();
       if ($this->userCertificate != ""){
         $this->had_userCertificate= TRUE;
       }
@@ -202,15 +217,28 @@ class user extends plugin
     if (isset ($this->attrs['gender'])){
       $this->gender= strtoupper($this->attrs['gender'][0]);
     }
+    $this->orig_base = $this->base;
   }
 
 
+
+
   /* execute generates the html output for this node */
   function execute()
   {
     /* Call parent execute */
     plugin::execute();
 
+    if($this->multiple_support_active){
+      return($this->execute_multiple());
+    }
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
     $smarty= get_smarty();
 
     /* Fill calendar */
@@ -219,9 +247,14 @@ class user extends plugin
     } else {
       if(is_array($this->dateOfBirth)){
         $date = $this->dateOfBirth;
-      }else{
+  
+        // Trigger on dates like 1985-04-01, getdate only understands timestamps
+      } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
+        $date= getdate(strtotime($this->dateOfBirth));
+
+      } else {
         $date = getdate($this->dateOfBirth);
-      } 
+      }
     }
 
     $days= array();
@@ -256,14 +289,14 @@ class user extends plugin
     $sex= array(0 => " ", "F" => _("female"), "M" => _("male"));
     $smarty->assign("gender_list", $sex);
 
-    /* Assign prefered langage */
-    $language= array(0 => " ", "fr_FR" => ("fr_FR"), "en_EN" => ("en_EN"), "de_DE" => ("de_DE"), "it_IT" => ("it_IT"), "nl_NL" => ("nl_NL"));
+    $language= array_merge(array(0 => " ") ,get_languages(TRUE));
     $smarty->assign("preferredLanguage_list", $language);
 
     /* Get random number for pictures */
     srand((double)microtime()*1000000); 
     $smarty->assign("rand", rand(0, 10000));
 
+
     /* Do we represent a valid gosaAccount? */
     if (!$this->is_account){
       echo "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
@@ -276,7 +309,7 @@ class user extends plugin
     foreach($_POST as $name => $value){
       if(preg_match("/^chooseBase/",$name) && $once){
         $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this->allowedBasesToMoveTo());
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
         $this->dialog->setCurrentBase($this->base);
       }
     }
@@ -289,7 +322,12 @@ class user extends plugin
       if($this->dialog->isClosed()){
         $this->dialog = false;
       }elseif($this->dialog->isSelected()){
-        $this->base = $this->dialog->isSelected();
+
+        /* check if selected base is allowed to move to / create a new object */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
         $this->dialog= false;
       }else{
         return($this->dialog->execute());
@@ -297,22 +335,25 @@ class user extends plugin
     }
 
     /* Want picture edit dialog? */
-    if (isset($_POST['edit_picture'])){
-      /* Save values for later recovery, in case some presses
-         the cancel button. */
-      $this->old_jpegPhoto= $this->jpegPhoto;
-      $this->old_photoData= $this->photoData;
-      $this->picture_dialog= TRUE;
-      $this->dialog= TRUE;
+    if($this->acl_is_writeable("userPicture")) {
+      if (isset($_POST['edit_picture'])){
+        /* Save values for later recovery, in case some presses
+           the cancel button. */
+        $this->old_jpegPhoto= $this->jpegPhoto;
+        $this->old_photoData= $this->photoData;
+        $this->picture_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
     }
 
     /* Remove picture? */
-    if (isset($_POST['picture_remove'])){
-      $this->jpegPhoto= "*removed*";
-      $this->set_picture ("./images/default.jpg");
-      $this->is_modified= TRUE;
-
-      return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+    if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))) ){
+      if (isset($_POST['picture_remove'])){
+        $this->set_picture ();
+        $this->jpegPhoto= "*removed*";
+        $this->is_modified= TRUE;
+        return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+      }
     }
 
     /* Save picture */
@@ -322,11 +363,10 @@ class user extends plugin
       if ($_FILES['picture_file']['name'] != ""){
         if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
           print_red(_("The specified file has not been uploaded via HTTP POST! Aborted."));
-          exit;
+        }else{
+          /* Activate new picture */
+          $this->set_picture($_FILES['picture_file']['tmp_name']);
         }
-
-        /* Activate new picture */
-        $this->set_picture($_FILES['picture_file']['tmp_name']);
       }
       $this->picture_dialog= FALSE;
       $this->dialog= FALSE;
@@ -355,7 +395,7 @@ class user extends plugin
 
 
     /* Want certificate= */
-    if (isset($_POST['edit_cert'])){
+    if ((isset($_POST['edit_cert'])) && $this->acl_is_readable("Certificate")){
 
       /* Save original values for later reconstruction */
       foreach (array("certificateSerialNumber", "userCertificate",
@@ -386,57 +426,59 @@ class user extends plugin
 
 
     /* Remove certificate? */
-    foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){
-      if (isset($_POST["remove_$val"])){
+    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
+      foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){
+        if (isset($_POST["remove_$val"])){
 
-        /* Reset specified cert*/
-        $this->$val= "";
-        $this->is_modified= TRUE;
+          /* Reset specified cert*/
+          $this->$val= "";
+          $this->is_modified= TRUE;
+        }
       }
     }
 
-
     /* Upload new cert and close dialog? */    
-    if (isset($_POST['cert_edit_finish'])){
-
-      /* for all certificates do */
-      foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
-          as $val){
-
-        /* Check for clean upload */
-        if (array_key_exists($val."_file", $_FILES) &&
-            array_key_exists('name', $_FILES[$val."_file"]) &&
-            $_FILES[$val."_file"]['name'] != "" &&
-            is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
-          $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
+    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
+      if (isset($_POST['cert_edit_finish'])){
+
+        /* for all certificates do */
+        foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
+            as $val){
+
+          /* Check for clean upload */
+          if (array_key_exists($val."_file", $_FILES) &&
+              array_key_exists('name', $_FILES[$val."_file"]) &&
+              $_FILES[$val."_file"]['name'] != "" &&
+              is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
+            $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
+          }
         }
-      }
 
-      /* Save serial number */
-      if (isset($_POST["certificateSerialNumber"]) &&
-          $_POST["certificateSerialNumber"] != ""){
+        /* Save serial number */
+        if (isset($_POST["certificateSerialNumber"]) &&
+            $_POST["certificateSerialNumber"] != ""){
 
-        if (!is_id($_POST["certificateSerialNumber"])){
-          print_red (_("Please enter a valid serial number"));
+          if (!is_id($_POST["certificateSerialNumber"])){
+            print_red (_("Please enter a valid serial number"));
 
-          foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
-            if ($this->$cert != ""){
-              $smarty->assign("$cert"."_state", "true");
-            } else {
-              $smarty->assign("$cert"."_state", "");
+            foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
+              if ($this->$cert != ""){
+                $smarty->assign("$cert"."_state", "true");
+              } else {
+                $smarty->assign("$cert"."_state", "");
+              }
             }
+            return ($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
           }
-          return ($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
+
+          $this->certificateSerialNumber= $_POST["certificateSerialNumber"];
+          $this->is_modified= TRUE;
         }
 
-        $this->certificateSerialNumber= $_POST["certificateSerialNumber"];
-        $this->is_modified= TRUE;
+        $this->cert_dialog= FALSE;
+        $this->dialog= FALSE;
       }
-
-      $this->cert_dialog= FALSE;
-      $this->dialog= FALSE;
     }
-
     /* Display picture dialog */
     if ($this->picture_dialog){
       return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
@@ -444,6 +486,9 @@ class user extends plugin
 
     /* Display cert dialog */
     if ($this->cert_dialog){
+      $smarty->assign("CertificateACL",$this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+      $smarty->assign("Certificate_readable",$this->acl_is_readable("Certificate"));
+
       foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
         if ($this->$cert != ""){
           /* import certificate */
@@ -453,8 +498,27 @@ class user extends plugin
           /* Read out data*/
           $timeto   = $certificate->getvalidto_date();
           $timefrom = $certificate->getvalidfrom_date();
-          $str = "<table summary=\"\" border=0><tr><td style='vertical-align:top'>CN</td><td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td></tr></table><br>".
-                  sprintf(_("Certificate is valid from %s to %s and is currently %s."), "<b>".date('d M Y',$timefrom)."</b>","<b>".date('d M Y',$timeto)."</b>", $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":"<b><font style='color:red'>"._("invalid")."</font></b>");
+         
+          
+          /* Additional info if start end time is '0' */
+          $add_str_info = "";
+          if($timeto == 0 && $timefrom == 0){
+            $add_str_info = "<br><i>"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)")."</i>";
+          }
+
+          $str = "<table summary=\"\" border=0>
+                    <tr>
+                      <td style='vertical-align:top'>CN</td>
+                      <td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td>
+                    </tr>
+                  </table><br>".
+
+                  sprintf(_("Certificate is valid from %s to %s and is currently %s."),
+                        "<b>".date('d M Y',$timefrom)."</b>",
+                        "<b>".date('d M Y',$timeto)."</b>",
+                        $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":
+                                                "<b><font style='color:red'>"._("invalid")."</font></b>").$add_str_info;
+
           $smarty->assign($cert."info",$str);
           $smarty->assign($cert."_state","true");
         } else {
@@ -466,32 +530,40 @@ class user extends plugin
       return($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
     }
 
-    /* Show us the edit screen */
-    @$smarty->assign("bases", $this->allowedBasesToMoveTo());
-#  $smarty->assign("bases", $this->config->idepartments);
-    $smarty->assign("base_select",      $this->base);
-    $smarty->assign("selectmode",       chkacl($this->acl, "create"));
-    $smarty->assign("certificatesACL",  chkacl($this->acl, "certificates"));
-    $smarty->assign("jpegPhotoACL",     chkacl($this->acl, "jpegPhoto"));
-
     /* Prepare password hashes */
     if ($this->pw_storage == ""){
       $this->pw_storage= $this->config->current['HASH'];
     }
 
-    $temp   = passwordMethod::get_available_methods();
+    $temp= passwordMethod::get_available_methods();
     $hashes = $temp['name'];
+    $test= new $temp[$this->pw_storage]($this->config);
+    $is_configurable= $test->is_configurable();
     
-    $smarty->assign("pwmode", $hashes);
-    $smarty->assign("pwmode_select", $this->pw_storage);
-    $smarty->assign("passwordStorageACL", chkacl($this->acl, "passwordStorage"));
-
     /* Load attributes and acl's */
+    $ui =get_userinfo();
     foreach($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl,$val));
     }
 
+    /* Set acls */
+    $tmp = $this->plinfo();
+    foreach($tmp['plProvidedAcls'] as $val => $translation){
+      $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    }
+
+    $smarty->assign("pwmode", $hashes);
+    $smarty->assign("pwmode_select", $this->pw_storage);
+    $smarty->assign("pw_configurable", $is_configurable);
+    $smarty->assign("passwordStorageACL", $this->getacl("userPassword",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("base_select",      $this->base);
+    $smarty->assign("CertificatesACL",  $this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("userPictureACL",   $this->getacl("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("userPicture_is_readable",   $this->acl_is_readable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+
+    /* Create base acls */
+    @$smarty->assign("bases", $this->allowedBasesToMoveTo());
+
     /* Save government mode attributes */
     if (isset($this->config->current['GOVERNMENTMODE']) &&
         preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){
@@ -501,22 +573,21 @@ class user extends plugin
       $smarty->assign("ivbbmodes", $ivbbmodes);
       foreach ($this->govattrs as $val){
         $smarty->assign("$val", $this->$val);
-        $smarty->assign("$val"."ACL", chkacl($this->acl,$val));
+        $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
       }
     } else {
       $smarty->assign("governmentmode", "false");
     }
 
     /* Special mode for uid */
-    $uidACL= "";
+    $uidACL= $this->getacl("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])));
     if (isset ($this->dn)){
       if ($this->dn != "new"){
-        $uidACL="readonly";
+        $uidACL= preg_replace("/w/","",$uidACL);
       }
     }  else {
-      $uidACL= "readonly";
+      $uidACL= preg_replace("/w/","",$uidACL);
     }
-    $uidACL.= " ".chkacl($this->acl, "uid");
     
     $smarty->assign("uidACL", $uidACL);
     $smarty->assign("is_template", $this->is_template);
@@ -541,7 +612,10 @@ class user extends plugin
   {
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir ($this->dn);
-
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn));
+  
+    new log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
+  
     /* Delete references to groups */
     $ldap->cd ($this->config->current['BASE']);
     $ldap->search ("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("uid"));
@@ -560,15 +634,35 @@ class user extends plugin
       $og->save ();
     }
 
+    /* If needed, let the password method do some cleanup */
+    $tmp = new passwordMethod($_SESSION['config']);
+    $available = $tmp->get_available_methods();
+    if (in_array_ics($this->pw_storage, $available['name'])){
+      $test= new $available[$this->pw_storage]($this->config);
+      $test->attrs= $this->attrs;
+      $test->dn= $this->dn;
+      $test->remove_from_parent();
+    }
+
+    /* Remove ACL dependencies too */
+    $tmp = new acl($this->config,$this->parent,$this->dn);
+    $tmp->remove_acl();
+
     /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
+    $this->handle_post_events("remove",array("uid" => $this->uid));
   }
 
 
   /* Save data to object */
   function save_object()
   {
-    if (isset($_POST['generic'])){
+    if (isset($_POST['multiple_user_posted'])){
+      $this->save_object_multiple();
+    }
+    if(isset($_POST['generic']) || isset($_POST['multiple_user_posted'])){
+
+      /* Make a backup of the current selected base */
+      $base_tmp = $this->base;
 
       /* Parents save function */
       plugin::save_object ();
@@ -576,7 +670,7 @@ class user extends plugin
       /* Save government mode attributes */
       if ($this->config->current['GOVERNMENTMODE']){
         foreach ($this->govattrs as $val){
-          if (chkacl ($this->acl, "$val") == "" && isset ($_POST["$val"])){
+          if ($this->acl_is_writeable($val,(!is_object($this->parent) && !isset($_SESSION['edit']))) && isset($_POST["$val"])){
             $data= stripcslashes($_POST["$val"]);
             if ($data != $this->$val){
               $this->is_modified= TRUE;
@@ -594,7 +688,24 @@ class user extends plugin
 
       /* Save base and pw_storage, since these are no LDAP attributes */
       if (isset($_POST['base'])){
-        foreach(array("base", "pw_storage") as $val){
+
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$_POST['base']])){
+          $base= validate($_POST['base']);
+          if ($base != $this->base){
+            $this->is_modified= TRUE;
+          }
+          $this->base= $base;
+        }else{
+          $this->base = $base_tmp;
+          print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
+          $this->set_acl_base('dummy,'.$this->base);
+        }
+      }
+
+      /* Get pw_storage mode */
+      if (isset($_POST['pw_storage'])){
+        foreach(array("pw_storage") as $val){
           if(isset($_POST[$val])){
             $data= validate($_POST[$val]);
             if ($data != $this->$val){
@@ -604,6 +715,8 @@ class user extends plugin
           }
         }
       }
+
+      $this->set_acl_base('dummy,'.$this->base);
     }
   }
 
@@ -621,22 +734,26 @@ class user extends plugin
     }
   }
 
+  
   /* Save data to LDAP, depending on is_account we save or delete */
   function save()
   {
     /* Only force save of changes .... 
        If this attributes aren't changed, avoid saving.
      */
-    if ($this->use_dob == "1"){
-      $this->dateOfBirth= date("Y-m-d", $this->dateOfBirth);
-    }
     if($this->gender=="0") $this->gender ="";
     if($this->preferredLanguage=="0") $this->preferredLanguage ="";
     
     /* First use parents methods to do some basic fillup in $this->attrs */
     plugin::save ();
 
+    if ($this->use_dob == "1"){
+      /* 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->dateOfBirth);
+      }
+    }
+
     /* Remove additional objectClasses */
     $tmp= array();
     foreach ($this->attrs['objectClass'] as $key => $set){
@@ -669,7 +786,7 @@ class user extends plugin
       foreach ($this->govattrs as $val){
         if ($this->$val != ""){
           $this->attrs["$val"]= $this->$val;
-        } elseif (!$this->new) {
+        } elseif (!$this->is_new) {
           $this->attrs["$val"]= array();
         }
       }
@@ -677,7 +794,7 @@ class user extends plugin
       /* Remove attribute if set to "nein" */
       if ($this->publicVisible == "nein"){
         $this->attrs['publicVisible']= array();
-        if($this->new){
+        if($this->is_new){
           unset($this->attrs['publicVisible']);
         }else{
           $this->attrs['publicVisible']=array();
@@ -697,21 +814,21 @@ class user extends plugin
 
     /* Special handling for dateOfBirth value */
     if ($this->use_dob != "1"){
-      if ($this->new) {
+      if ($this->is_new) {
         unset($this->attrs["dateOfBirth"]);
       } else {
         $this->attrs["dateOfBirth"]= array();
       }
     }
     if (!$this->gender){
-      if ($this->new) {
+      if ($this->is_new) {
         unset($this->attrs["gender"]);
       } else {
         $this->attrs["gender"]= array();
       }
     }
     if (!$this->preferredLanguage){
-      if ($this->new) {
+      if ($this->is_new) {
         unset($this->attrs["preferredLanguage"]);
       } else {
         $this->attrs["preferredLanguage"]= array();
@@ -720,7 +837,12 @@ class user extends plugin
 
     /* Special handling for attribute jpegPhote needed, scale image via
        image magick to 147x200 pixels and inject resulting data. */
-    if ($this->jpegPhoto != "*removed*"){
+    if ($this->jpegPhoto == "*removed*"){
+    
+      /* Reset attribute to avoid writing *removed* as value */    
+      $this->attrs["jpegPhoto"] = array();
+
+    } else {
 
       /* Fallback if there's no image magick inside PHP */
       if (!function_exists("imagick_blob2image")){
@@ -757,22 +879,22 @@ class user extends plugin
 
         /* Load the new uploaded Photo */
         if(!$handle  =  imagick_blob2image($this->photoData))  {
-          gosa_log("Can't Load image");
+          new log("debug","users/".get_class($this),"",array(),"Could not access uploaded image");
         }
 
         /* Resizing image to 147x200 and blur */
         if(!imagick_resize($handle,147,200,IMAGICK_FILTER_GAUSSIAN,0)){
-          gosa_log("imagick_resize failed");
+          new log("debug","users/".get_class($this),"",array(),"Could not resize uploaded image");
         }
 
         /* Converting image to JPEG */
         if(!imagick_convert($handle,"JPEG")) {
-          gosa_log("Can't Convert to JPEG");
+          new log("debug","users/".get_class($this),"",array(),"Could not convert uploaded image to jepg");
         }
 
         /* Creating binary Code for the Image */
         if(!$dump = imagick_image2blob($handle)){
-          gosa_log("Can't create blob for image");
+          new log("debug","users/".get_class($this),"",array(),"Could not create new user image");
         }
 
         /* Sending Image */
@@ -782,33 +904,25 @@ class user extends plugin
         $this->attrs["jpegPhoto"] = $output;
       }
 
-    } elseif(!$this->new) {
-      $this->attrs["jpegPhoto"] = array();
-    }
-
-    /* Build new dn */
-    if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
-      $new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
-    } else {
-      $new_dn= 'cn='.$this->cn.','.get_people_ou().$this->base;
     }
 
     /* This only gets called when user is renaming himself */
     $ldap= $this->config->get_ldap_link();
-    if ($this->dn != $new_dn){
+    if ($this->dn != $this->new_dn){
 
       /* Write entry on new 'dn' */
-      $this->move($this->dn, $new_dn);
+      $this->update_acls($this->dn,$this->new_dn);
+      $this->move($this->dn, $this->new_dn);
 
       /* Happen to use the new one */
-      change_ui_dn($this->dn, $new_dn);
-      $this->dn= $new_dn;
+      change_ui_dn($this->dn, $this->new_dn);
+      $this->dn= $this->new_dn;
     }
 
 
     /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
        new entries. So do a check first... */
-    $ldap->cat ($this->dn);
+    $ldap->cat ($this->dn, array('dn'));
     if ($ldap->fetch()){
       $mode= "modify";
     } else {
@@ -827,16 +941,35 @@ class user extends plugin
 
     /* Finally write data with selected 'mode' */
     $this->cleanup();
+
+    if(isset($this->attrs['preferredLanguage'])){
+      $_SESSION['ui']->language = $this->preferredLanguage;
+      $_SESSION['Last_init_lang'] = "update";
+    }
+
     $ldap->cd ($this->dn);
     $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error())){
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/generic account with dn '%s' failed."),$this->dn))){
       return (1);
     }
 
+
+    /* Remove ACL dependencies too */
+    if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
+      $tmp = new acl($this->config,$this->parent,$this->dn);
+      $tmp->update_acl_membership($this->orig_dn,$this->dn);
+    }
+
+    if($mode == "modify"){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     /* Remove cert? 
        For some reason, the 'ldap' class doesn't want to remove binary entries, so I need
        to work around myself. */
-    if ($remove_userCertificate == true && !$this->new && $this->had_userCertificate){
+    if ($remove_userCertificate == true && !$this->is_new && $this->had_userCertificate){
 
       /* Reset array, assemble new, this should be reworked */
       $this->attrs= array();
@@ -864,63 +997,28 @@ class user extends plugin
       ldap_close($ds);
     }
 
-    /* Kerberos server defined? */
-    if (isset($this->config->data['SERVERS']['KERBEROS'])){
-      $cfg= $this->config->data['SERVERS']['KERBEROS'];
-    }
-    if (isset($cfg['SERVER']) && function_exists('kadm5_init_with_password')){
-
-      /* Connect to the admin interface */
-      $handle = kadm5_init_with_password($cfg['SERVER'], $cfg['REALM'],
-          $cfg['ADMIN'], $cfg['PASSWORD']);
-
-      /* Errors? */            
-      if ($handle === FALSE){
-        print_red (_("Kerberos database communication failed"));
-        return (2);
+    /* If needed, let the password method do some cleanup */
+    if ($this->pw_storage != $this->last_pw_storage){
+      $tmp = new passwordMethod($_SESSION['config']);
+      $available = $tmp->get_available_methods();
+      if (in_array_ics($this->pw_storage, $available['name'])){
+        $test= new $available[$this->pw_storage]($this->config);
+        $test->attrs= $this->attrs;
+        $test->dn= $this->dn;
+        $test->remove_from_parent();
       }
-
-      /* Build user principal, get list of existsing principals */
-      $principal= $this->uid."@".$cfg['REALM'];
-      $principals = kadm5_get_principals($handle);
-
-      /* User exists in database? */
-      if (in_array($principal, $principals)){
-
-        /* Ok. User exists. Remove him/her when pw_storage has
-           changed to be NOT kerberos. */
-        if ($this->pw_storage != "kerberos"){
-          $ret= kadm5_delete_principal ( $handle, $principal);
-
-          if ($ret === FALSE){
-            print_red (_("Can't remove user from kerberos database."));
-          }
-        }
-
-      } else {
-
-        /* User doesn't exists, create it when pw_storage is kerberos. */
-        if ($this->pw_storage == "kerberos"){
-          $ret= kadm5_create_principal ( $handle, $principal);
-
-          if ($ret === FALSE){
-            print_red (_("Can't add user to kerberos database."));
-          }
-        }
-
-      }
-
-      /* Free kerberos admin handle */
-      kadm5_destroy($handle);
     }
 
     /* Optionally execute a command after we're done */
     if ($mode == "add"){
-      $this->handle_post_events("add");
+      $this->handle_post_events("add", array("uid" => $this->uid));
     } elseif ($this->is_modified){
-      $this->handle_post_events("modify");
+      $this->handle_post_events("modify", array("uid" => $this->uid));
     }
 
+    /* Fix tagging if needed */
+    $this->handle_object_tagging();
+
     return (0);
   }
 
@@ -928,75 +1026,81 @@ class user extends plugin
   /* Check formular input */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
 
-    /* Assemble cn */
-    $this->cn= $this->givenName." ".$this->sn;
+    $pt= "";
+    if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
+      if(!empty($this->personalTitle)){
+        $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"){
-      $new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
+      $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
     } else {
-      $new_dn= 'cn='.$this->cn.','.get_people_ou().$this->base;
-    }
-
-    $ui= get_userinfo();
-    $acl= get_permissions ($new_dn, $ui->subtreeACL);
-    $acl= get_module_permission($acl, "user", $new_dn);
-    if ($this->dn == "new" && chkacl($acl, "create") != ""){
-      $message[]= _("You have no permissions to create a user on this 'Base'.");
-    } elseif ($this->dn != $new_dn && $this->dn != "new"){
-      $acl= get_permissions ($this->dn, $ui->subtreeACL);
-      $acl= get_module_permission($acl, "user", $this->dn);
-      if (chkacl($acl, "create") != ""){
-        $message[]= _("You have no permissions to move a user from the original 'Base'.");
+      /* Don't touch dn, if cn hasn't changed */
+      if (isset($this->saved_attributes['cn']) && $this->saved_attributes['cn'] == $this->cn &&
+          $this->orig_base == $this->base ){
+        $this->new_dn= $this->dn;
+      } else {
+        $this->new_dn= $this->create_unique_dn('cn', get_people_ou().$this->base);
       }
     }
 
-    /* must: sn, givenName, uid */
-    if ($this->sn == "" && chkacl ($this->acl, "sn") == ""){
-      $message[]= _("The required field 'Name' is not set.");
+    /* Set the new acl base */
+    if($this->dn == "new") {
+      $this->set_acl_base($this->base);
     }
 
-    /* UID already used? */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(uid=$this->uid)", array("uid"));
-    $ldap->fetch();
-    if ($ldap->count() != 0 && $this->dn == 'new'){
-      $message[]= _("There's already a person with this 'Login' in the database.");
-    }
 
-    /* In template mode, the uid and givenName are autogenerated... */
-    if (!$this->is_template){
-      if ($this->givenName == "" && chkacl ($this->acl, "givenName") == ""){
-        $message[]= _("The required field 'Given name' is not set.");
+    if(!$this->multiple_support_active){
+
+      /* must: sn, givenName, uid */
+      if ($this->sn == "" && ($this->acl_is_writeable("sn",(!is_object($this->parent) && !isset($_SESSION['edit'])) || ($this->is_new)))){
+        $message[]= _("The required field 'Name' is not set.");
       }
-      if ($this->uid == "" && chkacl ($this->acl, "uid") == ""){
-        $message[]= _("The required field 'Login' is not set.");
+
+      /* UID already used? */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(uid=$this->uid)", array("uid"));
+      $ldap->fetch();
+      if ($ldap->count() != 0 && $this->dn == 'new'){
+        $message[]= _("There's already a person with this 'Login' in the database.");
       }
-      if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(cn=".$this->cn.")", array("uid"));
-        $ldap->fetch();
-        if ($ldap->count() != 0 && $this->dn != $new_dn && $this->dn == 'new'){
-          $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
+
+      /* In template mode, the uid and givenName are autogenerated... */
+      if (!$this->is_template){
+        if ($this->givenName == "" && $this->acl_is_writeable("givenName",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
+          $message[]= _("The required field 'Given name' is not set.");
+        }
+        if ($this->uid == "" && $this->acl_is_writeable("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])))){
+          $message[]= _("The required field 'Login' is not set.");
+        }
+        if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
+          $ldap->cat($this->new_dn);
+          if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
+            $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
+          }
         }
       }
-    }
 
-    /* Check for valid input */
-    if ($this->is_modified && !is_uid($this->uid)){
-      $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
-    }
-    if (!is_url($this->labeledURI)){
-      $message[]= _("The field 'Homepage' contains an invalid URL definition.");
-    }
-    if (preg_match ("/[\\\\]/", $this->sn)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    if (preg_match ("/[\\\\]/", $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
+      /* Check for valid input */
+      if ($this->is_modified && !is_uid($this->uid)){
+        $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
+      }
+      if (!is_url($this->labeledURI)){
+        $message[]= _("The field 'Homepage' contains an invalid URL definition.");
+      }
+      if (preg_match ("/[\\\\]/", $this->sn)){
+        $message[]= _("The field 'Name' contains invalid characters.");
+      }
+      if (preg_match ("/[\\\\]/", $this->givenName)){
+        $message[]= _("The field 'Given name' contains invalid characters.");
+      }
     }
 
     /* Check phone numbers */
@@ -1028,49 +1132,30 @@ class user extends plugin
   /* Indicate whether a password change is needed or not */
   function password_change_needed()
   {
-    return ($this->pw_storage != $this->last_pw_storage);
+    return($this->pw_storage != $this->last_pw_storage);
   }
 
 
   /* Load a jpegPhoto from LDAP, this is going to be simplified later on */
   function load_picture()
   {
-    /* make connection and read jpegPhoto */
-    $ds= ldap_connect($this->config->current['SERVER']);
-    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-    if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
-      ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
-      ldap_set_rebind_proc($ds, array(&$this, "rebind"));
-    }
-
-    if(isset($this->config->current['TLS']) &&
-        $this->config->current['TLS'] == "true"){
-
-      ldap_start_tls($ds);
-    }
-
-    $r= ldap_bind($ds);
-    $sr= @ldap_read($ds, $this->dn, "jpegPhoto=*", array("jpegPhoto"));
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $data = $ldap->get_attribute($this->dn,"jpegPhoto");
+      
+    if((!$data) || ($data == "*removed*")){ 
 
-    /* in case we don't get an entry, load a default picture */
-    $this->set_picture ("./images/default.jpg");
-    $this->jpegPhoto= "*removed*";
+      /* In case we don't get an entry, load a default picture */
+      $this->set_picture ();//"./images/default.jpg");
+      $this->jpegPhoto= "*removed*";
+    }else{
 
-    /* fill data from LDAP */
-    if ($sr) {
-      $ei=ldap_first_entry($ds, $sr);
-      if ($ei) {
-        if ($info = ldap_get_values_len($ds, $ei, "jpegPhoto")){
-          $this->photoData= $info[0];
-          $_SESSION['binary']= $this->photoData;
-          $_SESSION['binarytype']= "image/jpeg";
-          $this->jpegPhoto= "";
-        }
-      }
+      /* Set picture */
+      $this->photoData= $data;
+      $_SESSION['binary']= $this->photoData;
+      $_SESSION['binarytype']= "image/jpeg";
+      $this->jpegPhoto= "";
     }
-
-    /* close conncetion */
-    ldap_unbind($ds);
   }
 
 
@@ -1111,9 +1196,9 @@ class user extends plugin
 
 
   /* Load picture from file to object */
-  function set_picture($filename)
+  function set_picture($filename ="")
   {
-    if (!is_file($filename)){
+    if (!is_file($filename) || $filename =="" ){
       $filename= "./images/default.jpg";
       $this->jpegPhoto= "*removed*";
     }
@@ -1131,6 +1216,7 @@ class user extends plugin
   /* Load certificate from file to object */
   function set_cert($cert, $filename)
   {
+    if(!$thsi->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))) return;
     $fd = fopen ($filename, "rb");
     if (filesize($filename)>0) {
       $this->$cert= fread ($fd, filesize ($filename));
@@ -1172,7 +1258,7 @@ class user extends plugin
     }
 
     /* Get back uid/sn/givenName */
-    if ($this->parent != NULL){
+    if ($this->parent !== NULL){
       $this->uid= $this->parent->uid;
       $this->sn= $this->parent->sn;
       $this->givenName= $this->parent->givenName;
@@ -1184,43 +1270,9 @@ class user extends plugin
    */
   function allowedBasesToMoveTo()
   {
-    $allowed = array();
-    $ret_all = false;
-    if($this->uid == $_SESSION['ui']->username){
-      $ldap= $this->config->get_ldap_link(); 
-      $ldap->cd($this->config->current['BASE']); 
-      $ldap->search("(&(objectClass=posixGroup)(memberUid=".$_SESSION['ui']->username."))",array("gosaSubtreeACL"));
-       
-      while($attrs = $ldap->fetch()){
-    
-        if(isset($attrs['gosaSubtreeACL'])){
-        
-          foreach($attrs['gosaSubtreeACL'] as $attr){
-            if((preg_match("/:user#/",$attr))||(preg_match("/:all/",$attr))){
-              $s =  preg_replace("/^.*ou=groups,/","",$attrs['dn']);
-
-              foreach($this->config->idepartments as $key => $dep) {
-                if(preg_match("/".$s."/i",$key)){
-                  $allowed[$key] = $dep;
-                }
-              }
-            }
-          }
-        }
-      }
-      if(count($allowed) == 0){
-        foreach($this->config->idepartments as $key => $dep) {
-          if($this->base==$key){
-            $allowed[$key] = $dep;
-          }
-        }
-      }  
-  
-      return($allowed);
-      
-    }else{
-      return($this->config->idepartments);
-    }
+    /* Get bases */
+    $bases  = $this->get_allowed_bases();
+    return($bases);
   } 
 
 
@@ -1237,21 +1289,32 @@ class user extends plugin
 
     $smarty = get_smarty();
 
+    $smarty->assign("passwordTodo","clear");
+
+    if(isset($_POST['passwordTodo'])){
+      $smarty->assign("passwordTodo",$_POST['passwordTodo']);
+    }
+
     $smarty->assign("sn",       $this->sn);
     $smarty->assign("givenName",$this->givenName);
     $smarty->assign("uid",      $this->uid);
     $smarty->assign("rand",     $rand);
     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-  
-    return($str);
+
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";  
+    return($ret);
   }
 
   function saveCopyDialog()
   {
+    /* Set_acl_base */
+    $this->set_acl_base("cn=dummy,".get_people_ou().$this->base);
 
     if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
       $this->set_picture($_FILES['picture_file']['tmp_name']);
-      echo "changed";
     }
 
     /* Remove picture? */
@@ -1268,6 +1331,171 @@ class user extends plugin
       }
     } 
   }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Reset certificate information addepted from source user
+       to avoid setting the same user certificate for the destination user. */
+    $this->userPKCS12= "";
+    $this->userSMIMECertificate= "";
+    $this->userCertificate= "";
+    $this->certificateSerialNumber= "";
+    $this->old_certificateSerialNumber= "";
+    $this->old_userPKCS12= "";
+    $this->old_userSMIMECertificate= "";
+    $this->old_userCertificate= "";
+  }
+
+
+  static function plInfo()
+  {
+  
+    $govattrs= array(
+        "gouvernmentOrganizationalUnit"             =>  _("Unit"), 
+        "houseIdentifier"                           =>  _("House identifier"), 
+        "vocation"                                  =>  _("Vocation"),
+        "ivbbLastDeliveryCollective"                =>  _("Last delivery"), 
+        "gouvernmentOrganizationalPersonLocality"   =>  _("Person locality"),
+        "gouvernmentOrganizationalUnitDescription"  =>  _("Unit description"),
+        "gouvernmentOrganizationalUnitSubjectArea"  =>  _("Subject area"),
+        "functionalTitle"                           =>  _("Functional title"),
+        "certificateSerialNumber"                   =>  _("Certificate serial number"),
+        "publicVisible"                             =>  _("Public visible"),
+        "street"                                    =>  _("Street"),
+        "role"                                      =>  _("Role"),
+        "postalCode"                                =>  _("Postal code"));
+
+    $ret = array(
+        "plShortName" => _("Generic"),
+        "plDescription" => _("Generic user settings"),
+        "plSelfModify"  => TRUE,
+        "plDepends"     => array(),
+        "plPriority"    => 1,
+        "plSection"     => array("personal" => _("My account")),
+        "plCategory"    => array("users" => array("description" => _("Users"),
+                                                  "objectClass" => "gosaAccount")),
+
+        "plProvidedAcls" => array(
+          "base"              => _("Base"), 
+          "userPassword"      => _("User password"), 
+          "sn"                => _("Surename"),
+          "givenName"         => _("Given name"),
+          "uid"               => _("User identification"),
+          "personalTitle"     => _("Personal title"),
+          "academicTitle"     => _("Academic title"),
+          "homePostalAddress" => _("Home postal address"),
+          "homePhone"         => _("Home phone number"),
+          "labeledURI"        => _("Homepage"),
+          "o"                 => _("Organization"),
+          "ou"                => _("Department"),
+          "dateOfBirth"       => _("Date of birth"),
+          "gender"            => _("Gender"),
+          "preferredLanguage" => _("Preferred language"),
+          "departmentNumber"  => _("Department number"),
+          "employeeNumber"    => _("Employee number"),
+          "employeeType"      => _("Employee type"),
+          "l"                 => _("Location"),
+          "st"                => _("State"),
+          "userPicture"       => _("User picture"),
+          "roomNumber"        => _("Room number"),
+          "telephoneNumber"   => _("Telefon number"),
+          "mobile"            => _("Mobile number"),
+          "pager"             => _("Pager number"),
+          "Certificate"        => _("User certificates"),
+
+          "postalAddress"                => _("Postal address"),
+          "facsimileTelephoneNumber"     => _("Fax number"))
+        );
+
+    /* Append government attributes if required */
+      global $config;
+    if (isset($config->current['GOVERNMENTMODE']) &&  preg_match('/true/i', $config->current['GOVERNMENTMODE'])){
+      foreach($govattrs as $attr => $desc){
+        $ret["plProvidedAcls"][$attr] = $desc;
+      }
+    }
+    return($ret);
+  }
+
+
+
+
+
+
+
+
+  function get_values_to_update()
+  {
+    $ret = plugin::get_multi_edit_values();
+    return($ret); 
+  }
+
+
+  function save_object_multiple()
+  {
+    foreach(array("pw_storage","base","edit_cert") as $attr){
+      if(isset($_POST["use_".$attr])){
+        $this->selected_edit_values[$attr] = TRUE;
+      }else{
+        $this->selected_edit_values[$attr] = FALSE;
+      }
+    }
+  }
+
+
+  function execute_multiple()
+  {
+    $smarty =get_smarty(); 
+    $language= array_merge(array(0 => "&nbsp;") ,get_languages(TRUE));
+    $smarty->assign("preferredLanguage_list", $language);
+    @$smarty->assign("bases", $this->allowedBasesToMoveTo());
+    $smarty->assign("base_select",      $this->base);
+
+    /* Save government mode attributes */
+    if (isset($this->config->current['GOVERNMENTMODE']) &&
+        preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){
+      $smarty->assign("governmentmode", "true");
+      $ivbbmodes= array("nein", "ivbv", "testa", "ivbv,testa", "internet",
+          "internet,ivbv", "internet,testa", "internet,ivbv,testa");
+      $smarty->assign("ivbbmodes", $ivbbmodes);
+      foreach ($this->govattrs as $val){
+        $smarty->assign("$val", $this->$val);
+        $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
+      }
+    } else {
+      $smarty->assign("governmentmode", "false");
+    }
+
+    $temp= passwordMethod::get_available_methods();
+    $hashes = $temp['name'];
+    $test= new $temp[$this->pw_storage]($this->config);
+    $is_configurable= $test->is_configurable();
+    $smarty->assign("pwmode", $hashes);
+    $smarty->assign("pwmode_select", $this->pw_storage);
+    $smarty->assign("pw_configurable", $is_configurable);
+
+    foreach($this->attributes as $attr){
+      if(isset($this->selected_edit_values[$attr]) && $this->selected_edit_values[$attr] == TRUE){
+        $smarty->assign("use_".$attr,TRUE);
+      }else{
+        $smarty->assign("use_".$attr,FALSE);
+      }
+      $smarty->assign($attr,$this->$attr);
+    }
+    foreach(array("pw_storage","base","edit_cert") as $attr){
+      if(isset($this->selected_edit_values[$attr]) && $this->selected_edit_values[$attr] == TRUE){
+        $smarty->assign("use_".$attr,TRUE);
+      }else{
+        $smarty->assign("use_".$attr,FALSE);
+      }
+    }
+    return($smarty->fetch (get_template_path('multiple_generic.tpl', TRUE, dirname(__FILE__))));
+  }
+
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: