X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fusers%2Fclass_userManagement.inc;h=ab0d224943c7e6a540a8078a42dca0db7b6d3275;hb=933ecbdd14e8e3ce99ca2f57731549304dfdd7b7;hp=6b9555930835a9500605024b0de4417cc98c67c7;hpb=602f71f2ee874ce922adbdd242657602995e383d;p=gosa.git diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 6b9555930..ab0d22494 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -23,7 +23,7 @@ class userManagement extends management { var $plHeadline = "Users"; - var $plDescription = "Manage users"; + var $plDescription = "Manage aspects of user accounts like generic, posix, samba and mail settings"; var $plIcon = "plugins/users/images/user.png"; var $sn = ""; @@ -33,6 +33,7 @@ class userManagement extends management var $edit_uid = ""; var $pwd_change_queue = array(); + var $force_hash_type = array(); // Tab definition protected $tabClass = "usertabs"; @@ -74,24 +75,6 @@ class userManagement extends management parent::__construct($config, $ui, "users", $headpage); - $this->registerAction("new", "newEntry"); - $this->registerAction("edit", "editEntry"); - $this->registerAction("apply", "applyChanges"); - $this->registerAction("save", "saveChanges"); - $this->registerAction("cancel", "cancelEdit"); - $this->registerAction("remove", "removeEntryRequested"); - $this->registerAction("removeConfirmed", "removeEntryConfirmed"); - - $this->registerAction("copy", "copyPasteHandler"); - $this->registerAction("cut", "copyPasteHandler"); - $this->registerAction("paste", "copyPasteHandler"); - - $this->registerAction("snapshot", "createSnapshotDialog"); - $this->registerAction("restore", "restoreSnapshotDialog"); - $this->registerAction("saveSnapshot","saveSnapshot"); - $this->registerAction("restoreSnapshot","restoreSnapshot"); - $this->registerAction("cancelSnapshot","closeDialogs"); - // Register special user actions $this->registerAction("lock", "lockEntry"); $this->registerAction("lockUsers", "lockUsers"); @@ -109,6 +92,16 @@ class userManagement extends management $this->registerAction("sendMessage", "sendMessage"); $this->registerAction("saveEventDialog", "saveEventDialog"); $this->registerAction("abortEventDialog", "closeDialogs"); + + // Register shortcut icon actions + $this->registerAction("edit_user","editEntry"); + $this->registerAction("edit_posixAccount","editEntry"); + $this->registerAction("edit_mailAccount","editEntry"); + $this->registerAction("edit_sambaAccount","editEntry"); + $this->registerAction("edit_netatalk","editEntry"); + $this->registerAction("edit_environment","editEntry"); + $this->registerAction("edit_gofaxAccount","editEntry"); + $this->registerAction("edit_phoneAccount","editEntry"); } @@ -129,6 +122,22 @@ class userManagement extends management } + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $str = management::editEntry($action,$target); + if($str) return($str); + + if(preg_match("/^edit_/",$action)){ + $tab = preg_replace("/^edit_/","",$action); + if(isset($this->tabObject->by_object[$tab])){ + $this->tabObject->current = $tab; + }else{ + trigger_error("Unknown tab: ".$tab); + } + } + } + + function closeDialogs() { management::closeDialogs(); @@ -219,11 +228,12 @@ class userManagement extends management function handlePasswordQueue() { + $smarty = get_smarty(); + // Get next entry from queue. if(empty($this->dn) && count($this->pwd_change_queue)){ $this->dn = array_pop($this->pwd_change_queue); set_object_info($this->dn); - $smarty = get_smarty(); return ($smarty->fetch(get_template_path('password.tpl', TRUE))); } @@ -244,13 +254,18 @@ class userManagement extends management // Display errors if (count($message) != 0){ msg_dialog::displayChecks($message); - $smarty = get_smarty(); return($smarty->fetch(get_template_path('password.tpl', TRUE))); } // Change cassword - if(!change_password ($this->dn, $_POST['new_password'])){ - return($smarty->fetch(get_template_path('password.tpl', TRUE))); + if(isset($this->force_hash_type[$this->dn])){ + if(!change_password ($this->dn, $_POST['new_password'],0,$this->force_hash_type[$this->dn])){ + return($smarty->fetch(get_template_path('password.tpl', TRUE))); + } + }else{ + if(!change_password ($this->dn, $_POST['new_password'])){ + return($smarty->fetch(get_template_path('password.tpl', TRUE))); + } } if ($this->config->get_cfg_value("passwordHook") != ""){ exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr); @@ -279,8 +294,36 @@ class userManagement extends management */ function saveChanges() { - management::saveChanges(); - if($this->last_dn == "new"){ + $str = management::saveChanges(); + + if(!empty($str)) return($str); + + if($this->last_tabObject instanceOf multi_plug){ + foreach($this->last_tabObject->a_handles as $user){ + if($user->password_change_needed()){ + $this->force_hash_type[$user->dn] = $user->by_object['user']->pw_storage; + $this->pwd_change_queue[] = $user->dn; + } + } + return($this->handlePasswordQueue()); + } + + if(isset($this->last_tabObject->by_object['user']) && $this->last_tabObject->by_object['user']->password_change_needed()){ + $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage; + $this->pwd_change_queue[] = $this->last_tabObject->dn; + return($this->handlePasswordQueue()); + } + } + + function cancelEdit() + { + $str = management::cancelEdit(); + if(!empty($str)) return($str); + + if(isset($this->last_tabObject->by_object['user']) && + $this->last_tabObject->by_object['user']->dn != "new" && + $this->last_tabObject->by_object['user']->password_change_needed()){ + $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage; $this->pwd_change_queue[] = $this->last_tabObject->dn; return($this->handlePasswordQueue()); } @@ -294,7 +337,8 @@ class userManagement extends management function newUserFromTemplate($action="",$target=array(),$all=array()) { // Call parent method, it knows whats to do, locking and so on ... - management::newEntry($action,$target,$all); + $str = management::newEntry($action,$target,$all); + if(!empty($str)) return($str); // Reset uid selection. $this->got_uid= ""; @@ -326,11 +370,12 @@ class userManagement extends management * if he wants to use one. * -> See 'templateContinue' for further handling. */ - function newEntry($action="",$target=array(),$all=array()) + function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") { // Call parent method, it manages everything, locking, object creation... - management::newEntry($action,$target,$all); + $str = management::newEntry($action,$target,$all); + if(!empty($str)) return($str); // If we've at least one template, then ask the user if he wants to use one? $templates = array(); @@ -338,7 +383,7 @@ class userManagement extends management $templates = array_merge($templates,$this->get_templates()); // Display template selection - if (count($templates)){ + if (count($templates) > 1){ $smarty = get_smarty(); // Set default variables, normally empty. @@ -484,7 +529,7 @@ class userManagement extends management // Adapt template values. $template_dn = $_POST['template']; $this->tabObject->adapt_from_template($template_dn, array("uid","cn","givenName","sn")); - $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/", '', $template_dn); + $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/i')."/", '', $template_dn); $this->tabObject->by_object['user']->base= $template_base; // The user Tab object is already instantiated, so just go back and let the @@ -507,6 +552,7 @@ class userManagement extends management // Check entry locking foreach($target as $dn){ if (($user= get_lock($dn)) != ""){ + $this->dn = $dn; return(gen_locked_message ($user, $dn)); } $this->dns[] = $dn; @@ -555,6 +601,7 @@ class userManagement extends management */ function lockUsers($action,$target,$all) { + if(!count($target)) return; if($action == "lockUsers"){ $this->lockEntry($action,$target, $all, "lock"); }else{ @@ -655,6 +702,23 @@ class userManagement extends management } + function copyPasteHandler($action="",$target=array(),$all=array(), + $altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="") + { + if ($this->config->boolValueIsTrue("main", "copyPaste")){ + $this->cpHandler->lastdn = ""; + $str = management::copyPasteHandler($action,$target,$all); + if($this->cpHandler->lastdn != "" && isset($_POST['passwordTodo']) && $_POST['passwordTodo'] == "new"){ + $this->pwd_change_queue[] = $this->cpHandler->lastdn; + return($this->handlePasswordQueue()); + } + return($str); + } + + return ""; + } + + static function filterLockImage($userPassword) { $image= "images/empty.png"; @@ -674,7 +738,7 @@ class userManagement extends management $label= ""; if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){ if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){ - $label= _("Unlock account"); + $label= _("Unlock account").""; }else{ $label= _("Lock account"); } @@ -703,30 +767,28 @@ class userManagement extends management "alt" => _("Samba"), "title" => _("Edit samba properties")), "apple-user" => array("image" => "plugins/netatalk/images/select_netatalk.png", - "plugin" => "sambaAccount", + "plugin" => "netatalk", "alt" => _("Netatalk"), "title" => _("Edit netatalk properties")), "gotoEnvironment" => array("image" => "plugins/users/images/small_environment.png", - "plugin" => "gotoEnvironment", + "plugin" => "environment", "alt" => _("Environment"), "title" => _("Edit environment properties")), "goFaxAccount" => array("image" => "plugins/users/images/fax_small.png", - "plugin" => "goFaxAccount", + "plugin" => "gofaxAccount", "alt" => _("FAX"), "title" => _("Edit FAX properties")), "goFonAccount" => array("image" => "plugins/gofon/images/select_phone.png", - "plugin" => "goFonAccount", + "plugin" => "phoneAccount", "alt" => _("Phone"), "title" => _("Edit phone properties"))); // Walk thru map foreach ($map as $oc => $properties) { if (in_array_ics($oc, $classes)) { - $result.=""; + $result.= image($properties['image'], "listing_edit_".$properties['plugin']."_$row", $properties['title']); } else { - $result.=" "; + $result.= image('images/empty.png'); } } return $result;