From ea78f99d4ccd42ef04002d96762e47cc63dd2e36 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 16 Aug 2007 07:45:12 +0000 Subject: [PATCH] Updated user list, allow multiple password changes. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7064 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/users/class_divListUsers.inc | 2 + plugins/admin/users/class_userManagement.inc | 81 ++++++++++++-------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/plugins/admin/users/class_divListUsers.inc b/plugins/admin/users/class_divListUsers.inc index c796b1869..35b057b27 100644 --- a/plugins/admin/users/class_divListUsers.inc +++ b/plugins/admin/users/class_divListUsers.inc @@ -166,6 +166,8 @@ class divListUsers extends MultiSelectWindow /* Multiple options */ $listhead .= "  "; + $listhead .= "  "; /* Add multiple copy & cut icons */ if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){ diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index ffc1a3479..57b3cf06a 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -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 ********************/ -- 2.30.2