Code

Updated user list, allow multiple password changes.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Aug 2007 07:45:12 +0000 (07:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Aug 2007 07:45:12 +0000 (07:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7064 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/users/class_divListUsers.inc
plugins/admin/users/class_userManagement.inc

index c796b1869d86943f08549e7d2fa6375e4b177d56..35b057b2766aeda1a13401817d6157de205ea0ff 100644 (file)
@@ -166,6 +166,8 @@ class divListUsers extends MultiSelectWindow
     /* Multiple options */ 
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected user")."' alt='"._("Remove user")."' name='remove_multiple_users'>&nbsp;";
+    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/list_password.png'
+        title='"._("Change password")."' alt='"._("Change password")."' name='multiple_password_change'>&nbsp;";
 
     /* Add multiple copy & cut icons */
     if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
index ffc1a34791484fa6377d49dc2ceb9cb1cb01c3d3..57b3cf06ad858358c1d3e1b1e18db0d9f7de3c65 100644 (file)
@@ -37,6 +37,8 @@ class userManagement extends plugin
   var $CPPasswordChange     = ""; // Contains the entry id which should get a new password
   var $DivListUsers;
 
+  var $pwd_change_queue     = array();
+
   var $start_pasting_copied_objects = FALSE;
 
   function userManagement($config, $ui)
@@ -87,6 +89,7 @@ class userManagement extends plugin
                     "editPaste" => "editPaste",  
                     "copy_multiple" => "multiple_copy_users",
                     "cut_multiple" => "multiple_cut_users",
+                    "multiple_password_change" => "multiple_password_change",
                     "copy"      => "^copy",
                     "toggle_lock_status" => "toggle_lock_status",
                     "cut"       => "^cut") as $act => $name){
@@ -129,37 +132,6 @@ class userManagement extends plugin
     }
 
 
-    /********************
-      Change password requested  
-     ********************/
-
-    /* Password change requested */
-    if (($s_action == "change_pw") || (!empty($this->CPPasswordChange))){
-
-      if(!empty($this->CPPasswordChange)){
-        $s_entry = $this->CPPasswordChange;
-        $this->CPPasswordChange = "";
-      }
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      if (preg_match("/w/",$this->ui->get_permissions($this->dn,"users/password"))){
-
-        /* User is allowed to change passwords, save 'dn' and 'acl' for next
-           dialog. */
-        $_SESSION['objectinfo']= $this->dn;
-        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
-
-      } else {
-        /* User is not allowed. Show message and cancel. */
-        print_red (_("You are not allowed to set this users password!"));
-      }
-    }
-
-
     /********************
       Change password confirmed
      ********************/
@@ -247,6 +219,53 @@ class userManagement extends plugin
     }
 
 
+    /********************
+     Change multiple passwords requested 
+     ********************/
+  
+    if($s_action == "multiple_password_change"){
+      $this->pwd_change_queue = $this->list_get_selected_items();
+    }    
+
+
+    /********************
+      Change password requested  
+     ********************/
+
+    /* Password change requested */
+    if (($s_action == "change_pw") || (!empty($this->CPPasswordChange)) || count($this->pwd_change_queue)){
+
+      /* Get users whose passwords should be changed. */
+      if(count($this->pwd_change_queue)){
+        $s_entry= array_pop($this->pwd_change_queue);
+      }
+
+      if(!empty($this->CPPasswordChange)){
+        $s_entry = $this->CPPasswordChange;
+        $this->CPPasswordChange = "";
+      }
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      if (preg_match("/w/",$this->ui->get_permissions($this->dn,"users/password"))){
+
+        /* User is allowed to change passwords, save 'dn' and 'acl' for next
+           dialog. */
+        $_SESSION['objectinfo']= $this->dn;
+        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+
+      } else {
+        /* User is not allowed. Show message and cancel. */
+        print_red (_("You are not allowed to set this users password!"));
+      }
+    }
+
+
+
+
     /********************
       Edit existing entry 
      ********************/