X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fusers%2Fclass_userManagement.inc;h=ab0d224943c7e6a540a8078a42dca0db7b6d3275;hb=933ecbdd14e8e3ce99ca2f57731549304dfdd7b7;hp=06c42283eaa2294df254335234dbc6ceac6a9a47;hpb=b31e329e6c32401a60ab509667752f1bffbe1355;p=gosa.git diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 06c42283e..ab0d22494 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -20,848 +20,457 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -class userManagement extends plugin +class userManagement extends management { - /* Plugin definitions */ var $plHeadline = "Users"; - var $plDescription = "Manage users"; - var $plIcon = "plugins/users/images/user.png"; - - /* Dialog attributes */ - var $usertab = NULL; - var $ui = NULL; - var $templates = array(); - var $got_uid = false; - var $CopyPasteHandler = NULL; - 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; - var $msg_dialog= NULL; - var $acl_module = array("users"); - var $dns = array(); - - // Filter/headpage tests - var $filter= null; - var $headpage= null; - - - function userManagement(&$config, $ui) + var $plDescription = "Manage aspects of user accounts like generic, posix, samba and mail settings"; + var $plIcon = "plugins/users/images/user.png"; + + var $sn = ""; + var $givenName = ""; + var $uid = ""; + var $got_uid = ""; + var $edit_uid = ""; + + var $pwd_change_queue = array(); + var $force_hash_type = array(); + + // Tab definition + protected $tabClass = "usertabs"; + protected $tabType = "USERTABS"; + protected $aclCategory = "users"; + protected $aclPlugin = "user"; + protected $objectName = "user"; + + function __construct($config,$ui) { - /* Save configuration for internal use */ - $this->config= &$config; - $this->ui= &$ui; - - /* Copy & Paste handler */ - if ($this->config->boolValueIsTrue("main", "copyPaste")){ - $this->CopyPasteHandler= new CopyPasteHandler($this->config); + $this->config = $config; + $this->ui = $ui; + + $this->storagePoints = array(get_ou("userRDN")); + + // Build filter + if (session::global_is_set(get_class($this)."_filter")){ + $filter= session::global_get(get_class($this)."_filter"); + } else { + $filter = new filter(get_template_path("user-filter.xml", true)); + $filter->setObjectStorage($this->storagePoints); } + $this->setFilter($filter); - /* Creat dialog object */ - $this->DivListUsers = new divListUsers($this->config,$this); + // Build headpage + $headpage = new listing(get_template_path("user-list.xml", true)); + $headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel"); + $headpage->registerElementFilter("lockImage", "userManagement::filterLockImage"); + $headpage->registerElementFilter("filterProperties", "userManagement::filterProperties"); + $headpage->setFilter($filter); + // Add copy&paste and snapshot handler. + if ($this->config->boolValueIsTrue("main", "copyPaste")){ + $this->cpHandler = new CopyPasteHandler($this->config); + } + if($this->config->get_cfg_value("enableSnapshots") == "true"){ + $this->snapHandler = new SnapshotHandler($this->config); + } + + parent::__construct($config, $ui, "users", $headpage); + + // Register special user actions + $this->registerAction("lock", "lockEntry"); + $this->registerAction("lockUsers", "lockUsers"); + $this->registerAction("unlockUsers", "lockUsers"); + $this->registerAction("new_template", "newTemplate"); + $this->registerAction("newfromtpl", "newUserFromTemplate"); + $this->registerAction("templateContinue", "templateContinue"); + $this->registerAction("templatize", "templatizeUsers"); + $this->registerAction("templatizeContinue", "templatizeContinue"); + + $this->registerAction("password", "changePassword"); + $this->registerAction("passwordQueue", "handlePasswordQueue"); + $this->registerAction("passwordCancel", "closeDialogs"); + + $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"); } - function execute() + // Inject user actions + function detectPostActions() { - /* Call parent execute */ - plugin::execute(); - - /* LOCK MESSAGE Vars */ - session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/","/^item_selected/","/^remove_multiple_users/","/^multiple_edit/","/menu_action/")); + $action = management::detectPostActions(); + if(isset($_POST['template_continue'])) $action['action'] = "templateContinue"; + if(isset($_POST['templatize_continue'])) $action['action'] = "templatizeContinue"; + if(isset($_POST['save_event_dialog'])) $action['action'] = "saveEventDialog"; + if(isset($_POST['abort_event_dialog'])) $action['action'] = "abortEventDialog"; + if(isset($_POST['password_cancel'])){ + $action['action'] = "passwordCancel"; + }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']))){ + $action['action'] = "passwordQueue"; + } + return($action); + } - $smarty = get_smarty(); // Smarty instance - $s_action = ""; // Contains the action to be taken - $s_entry = ""; // The value for s_action - /* Edit entry button pressed? */ - if( isset($_GET['act']) && $_GET['act'] == "edit_entry" ){ - $s_action= "edit"; - $s_entry= validate($_GET['id']); - } + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $str = management::editEntry($action,$target); + if($str) return($str); - /* Test relevant POST values */ - foreach($_POST as $key => $val){ - - /* Get every possible POST combination and set s_action/s_entry accordingly */ - foreach(array("del" => "user_del", - "edit" => "user_edit", - "new" => "user_new", - "new_tpl" => "user_tplnew", - "del_multiple" => "^remove_multiple_users", - "create_user_from_tpl" => "userfrom_tpl", - "change_pw" => "user_chgpw", - "editPaste" => "editPaste", - "copy_multiple" => "multiple_copy_users", - "multiple_edit" => "multiple_edit", - "cut_multiple" => "multiple_cut_users", - "multiple_password_change" => "multiple_password_change", - "copy" => "^copy", - "toggle_lock_status" => "toggle_lock_status", - "cut" => "^cut") as $act => $name){ - - if (preg_match("/".$name.".*/", $key)){ - $s_action= $act; - $s_entry= preg_replace("/".$name."_/i", "", $key); - break; - } + 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); } - - } /* ...Test POST */ - - /* Remove coordinate prefix from POST, required by some browsers */ - $s_entry= preg_replace("/_.$/", "", $s_entry); - - /* Seperate possibly encoded tab and entry, default to tab "user" */ - if(preg_match("/.*-.*/", $s_entry)){ - $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry); - $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry); - }else{ - $s_tab= "user"; } + } - if(!$this->config->search($s_tab, 'class',array('tabs'))){ - $s_tab = "user"; - } - - if (isset($_POST['menu_action'])){ - - /* handle C&P from layers menu */ - if(preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){ - $s_action = "copy_multiple"; - } - if(preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){ - $s_action = "cut_multiple"; - } - if(preg_match("/^editPaste/",$_POST['menu_action'])){ - $s_action = "editPaste"; - } - - /* Create options */ - if($_POST['menu_action'] == "user_new"){ - $s_action = "new"; - } - if($_POST['menu_action'] == "user_tplnew"){ - $s_action = "new_tpl"; - } - if($_POST['menu_action'] == "multiple_edit"){ - $s_action = "multiple_edit"; - } - - /* handle remove from layers menu */ - if(preg_match("/^multiple_password_change/",$_POST['menu_action'])){ - $s_action = "multiple_password_change"; - } - - /* handle remove from layers menu */ - if(preg_match("/^remove_multiple/",$_POST['menu_action'])){ - $s_action = "del_multiple"; - } - if(preg_match("/^templatize_multiple/",$_POST['menu_action'])){ - $s_action = "templatize_multiple"; - } - - if(preg_match("/^event/",$_POST['menu_action'])){ - $s_action = $_POST['menu_action']; - } - } - - /* Use template */ - if(isset($_POST['templatize_continue'])){ - $s_action = "templatize_continue"; - } - - - /******************** - Create notification event - ********************/ + + function closeDialogs() + { + management::closeDialogs(); + $this->pwd_change_queue = array(); + } + - if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){ - $ids = $this->list_get_selected_items(); + /*! \brief Sends a message to a set of users using gosa-si events. + */ + function sendMessage($action="",$target=array(),$all=array()) + { + if(class_available("DaemonEvent")){ $uids = array(); - foreach($ids as $id){ - $uids[] = $this->list[$id]['uid'][0]; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + foreach($target as $dn){ + $ldap->cat($dn,array('uid')); + $attrs = $ldap->fetch(); + if(isset($attrs['uid'][0])){ + $uids[] = $attrs['uid'][0]; + } } if(count($uids)){ $events = DaemonEvent::get_event_types(USER_EVENT); - $event = preg_replace("/^event_/","",$s_action); + $event = "DaemonEvent_notify"; if(isset($events['BY_CLASS'][$event])){ $type = $events['BY_CLASS'][$event]; - $this->usertab = new $type['CLASS_NAME']($this->config); - $this->usertab->add_users($uids); - $this->usertab->set_type(SCHEDULED_EVENT); + $this->dialogObject = new $type['CLASS_NAME']($this->config); + $this->dialogObject->add_users($uids); + $this->dialogObject->set_type(SCHEDULED_EVENT); } } } + } - /* Abort event dialog */ - if(isset($_POST['abort_event_dialog'])){ - $this->usertab = FALSE; - } - - /* Save event */ - if(isset($_POST['save_event_dialog'])){ - $this->usertab->save_object(); - $msgs = $this->usertab->check(); - if(count($msgs)){ - msg_dialog::displayChecks($msgs); - }else{ - - $o_queue = new gosaSupportDaemon(); - $o_queue->append($this->usertab); - if($o_queue->is_error()){ - msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG); - }else{ - $this->usertab = FALSE; - } - } - } - - /* Display event */ - if($this->usertab instanceof DaemonEvent){ - $this->usertab->save_object(); - return($this->usertab->execute()); - } - - - /******************** - Copy & Paste - ********************/ - /* Display the copy & paste dialog, if it is currently open */ - if($this->CPPasswordChange == ""){ - $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry); - if($ret){ - return($ret); + /*! \brief Sends a message to a set of users using gosa-si events. + */ + function saveEventDialog() + { + $this->dialogObject->save_object(); + $msgs = $this->dialogObject->check(); + if(count($msgs)){ + msg_dialog::displayChecks($msgs); + }else{ + $o_queue = new gosaSupportDaemon(); + $o_queue->append($this->dialogObject); + if($o_queue->is_error()){ + msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG); } + $this->closeDialogs(); } + } - /******************** - Change password confirmed - ********************/ - - /* Perform password change */ - if (isset($_POST['password_finish'])){ - - /* For security reasons, check if user is allowed to set password again */ - $dn = $this->dn; - $acl = $this->ui->get_permissions($dn, "users/password"); - $cacl= $this->ui->get_permissions($dn, "users/user"); - - /* Are we allowed to create a new user or to set the password attribute? */ - if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){ - - /* Check input and feed errors into 'message' */ - $message= array(); - - /* Sanity checks... */ - if ($_POST['new_password'] != $_POST['repeated_password']){ - - /* Matching passwords in new and repeated? */ - $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match."); - } else { - - /* Empty password is not permitted by default. */ - if ($_POST['new_password'] == ""){ - msgPool::required(_("New password")); - } - } + /*! \brief Intiates template creation. + */ + function newTemplate($action,$entry) + { + $this->newEntry(); + $this->tabObject->set_template_mode (); + } - /* Errors, or password change? */ - if (count($message) != 0){ - /* Show error message and continue editing */ - msg_dialog::displayChecks($message); - return($smarty->fetch(get_template_path('password.tpl', TRUE))); - } - - $config= $this->config; - $ldap_ui= $this->config->get_ldap_link(); - if(isset($this->usertab->dn)){ - $ldap_ui->cat($this->usertab->dn,array("uid")); - $user = $ldap_ui->fetch(); - }else{ - $ldap_ui->cat($this->dn,array("uid")); - $user = $ldap_ui->fetch(); - } - if((is_array($user))&&(isset($user['uid']))){ - $username= $user['uid'][0]; - } - - /* Set password, perform required steps */ - if ($this->usertab){ - if ($this->usertab->password_change_needed()){ - $obj= $this->usertab->by_object['user']; - if(!change_password ($this->usertab->dn, $_POST['new_password'],0, $obj->pw_storage)){ - return($smarty->fetch(get_template_path('password.tpl', TRUE))); - } - if ($config->get_cfg_value("passwordHook") != ""){ - exec($config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr); - } - new log("modify","users/".get_class($this),$this->usertab->dn,array(),"Password has been changed"); - unset($this->usertab); - $this->usertab= NULL; - } - } else { - if(!change_password ($this->dn, $_POST['new_password'])){ - return($smarty->fetch(get_template_path('password.tpl', TRUE))); - } - if ($config->get_cfg_value("passwordHook") != ""){ - exec($config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr); - } - new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed"); - } - } else { + /*! \brief Queues a set of users for password changes + */ + function changePassword($action="",$target=array(),$all=array()) + { + $this->dn =""; + $this->pwd_change_queue = $target; - /* Missing permissions, show message */ - msg_dialog::display(_("Password change"),_("You have no permission to change this users password!"),WARNING_DIALOG); + // Check permisions + $disallowed = array(); + foreach($this->pwd_change_queue as $key => $dn){ + if(!preg_match("/w/",$this->ui->get_permissions($dn,$this->aclCategory."/password"))){ + unset($this->pwd_change_queue[$key]); + $disallowed[] = $dn; } - /* Clean session, delete lock */ - $this->remove_lock(); - unset ($this->usertab); - $this->usertab= NULL; - $this->lognames= array();; - $this->sn= ""; - $this->givenName= ""; - $this->uid= ""; - set_object_info(); } - - - /******************** - Change multiple passwords requested - ********************/ - - if($s_action == "multiple_password_change"){ - $this->pwd_change_queue = $this->list_get_selected_items(); - $disallowed = array(); - foreach($this->pwd_change_queue as $key => $id){ - if(!preg_match("/w/",$this->ui->get_permissions($this->list[trim($id)]['dn'],"users/password"))){ - unset($this->pwd_change_queue[$key]); - $disallowed[] = $this->list[trim($id)]['dn']; - } - } - if(count($disallowed)){ - msg_dialog::display(_("Permission"),msgPool::permModify($disallowed),INFO_DIALOG); - } - } - - - /******************** - 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. */ - set_object_info($this->dn); - return ($smarty->fetch(get_template_path('password.tpl', TRUE))); - } else { - /* User is not allowed. Show message and cancel. */ - msg_dialog::display(_("Password change"),_("You have no permission to change this users password!"),WARNING_DIALOG); - } + if(count($disallowed)){ + msg_dialog::display(_("Permission"),msgPool::permModify($disallowed),INFO_DIALOG); } + // Now display change dialog. + return($this->handlePasswordQueue()); + } - /******************** - Edit existing entry - ********************/ - - - /* User wants to edit data? */ - if (($s_action=="edit") && (!isset($this->usertab->config))){ - - /* Get 'dn' from posted 'uid', must be unique */ - $this->dn= $this->list[trim($s_entry)]['dn']; - - /* Check locking, save current plugin in 'back_plugin', so - the dialog knows where to return. */ - - if (($user= get_lock($this->dn)) != ""){ - return(gen_locked_message ($user, $this->dn,TRUE)); - } - - /* Lock the current entry, so everyone will get the - above dialog */ - add_lock ($this->dn, $this->ui->dn); - - /* Register usertab to trigger edit dialog */ - $this->usertab= new usertabs($this->config, - $this->config->data['TABS']['USERTABS'], $this->dn); - - /* Switch tab, if it was requested by the user */ - $this->usertab->current = $s_tab; + function handlePasswordQueue() + { + $smarty = get_smarty(); - /* Set ACL and move DN to the headline */ - $this->usertab->set_acl_base($this->dn); + // 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); + return ($smarty->fetch(get_template_path('password.tpl', TRUE))); } - - /******************** - Edit multiple entries - ********************/ - - /* User wants to edit data? */ - if ($s_action == "multiple_edit" && !isset($this->usertab->config)){ - - $this->dn = array(); - foreach($this->list_get_selected_items() as $id){ - $this->dn[] = $this->list[$id]['dn'];; - } - $tmp = new multi_plug($this->config,"usertabs",$this->config->data['TABS']['USERTABS'], - $this->dn,$this->DivListUsers->selectedBase,"user"); - if ($tmp->entries_locked()){ - return($tmp->display_lock_message()); - } - $tmp->lock_entries($this->ui->dn); - if($tmp->multiple_available()){ - $this->usertab = $tmp; - $this->usertab->set_active_tab($s_tab); - set_object_info($this->usertab->get_object_info()); + // Check permissions + $dn = $this->dn; + $acl = $this->ui->get_permissions($dn, "users/password"); + $cacl= $this->ui->get_permissions($dn, "users/user"); + if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){ + $message= array(); + if ($_POST['new_password'] != $_POST['repeated_password']){ + $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match."); + } else { + if ($_POST['new_password'] == ""){ + $message[] = msgPool::required(_("New password")); + } } - } - - /******************** - Edit canceled - ********************/ - - /* Reset all relevant data, if we get a _cancel request */ - if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){ - if (isset($this->usertab)){ - $this->remove_lock(); + // Display errors + if (count($message) != 0){ + msg_dialog::displayChecks($message); + return($smarty->fetch(get_template_path('password.tpl', TRUE))); } - $this->usertab= NULL; - $this->lognames= array();; - $this->sn= ""; - $this->givenName= ""; - $this->uid= ""; - set_object_info(); - } - - /******************** - We want to create a new user, so fetch all available user templates - ********************/ - - /* Generate template list */ - if ($s_action == "new" || $s_action == "create_user_from_tpl" || $s_action == "templatize_multiple"){ - - $this->templates= array(); - $ldap= $this->config->get_ldap_link(); - - /* Create list of templates */ - foreach ($this->config->departments as $key => $value){ - - /* Get acls from different ou's */ - $acl = $this->ui->get_permissions($value,"users/user") ; - - /* If creation of a new user is allowed, append this template */ - if (preg_match("/c/",$acl)){ - - /* Search all templates from the current dn */ - $ldap->cd (get_people_ou().$value); - $ldap->search ("(objectClass=gosaUserTemplate)", array("uid")); - - /* Append */ - if ($ldap->count() != 0){ - while ($attrs= $ldap->fetch()){ - $this->templates[$ldap->getDN()]= - $attrs['uid'][0]." - ".LDAP::fix($key); - } - if ($s_action != "templatize_multiple"){ - $this->templates['none']= _("none"); - } - } + // Change cassword + 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))); } } - - /* Sort templates */ - natcasesort ($this->templates); - reset ($this->templates); + if ($this->config->get_cfg_value("passwordHook") != ""){ + exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr); + } + new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed"); + $this->dn =""; + + } else { + msg_dialog::display(_("Password change"), + _("You have no permission to change this users password!"), + WARNING_DIALOG); } + // Cleanup + if(!count($this->pwd_change_queue)){ + $this->remove_lock(); + $this->closeDialogs(); + }else{ + return($this->handlePasswordQueue()); + } + } - /******************** - Apply template to multiple entries requested, display confirm dialog - ********************/ - if ($s_action=="templatize_multiple"){ - $ids = $this->list_get_selected_items(); - $this->dns = array(); - if(count($ids)){ + /*! \brief Save user modifications. + * Whenever we save a 'new' user, request a password change for him. + */ + function saveChanges() + { + $str = management::saveChanges(); + + if(!empty($str)) return($str); - foreach($ids as $id){ - $dn = $this->list[$id]['dn']; - if (($user= get_lock($dn)) != ""){ - return(gen_locked_message ($user, $dn)); - } - $this->dns[$id] = $dn; + 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; } } - - $smarty->assign("templates", $this->templates); - - return($smarty->fetch(get_template_path('templatize.tpl', TRUE))); + return($this->handlePasswordQueue()); } - /* Perform templatizing after the button has been pressed */ - if ($s_action == "templatize_continue"){ - - $acl = $this->ui->get_permissions($_POST['template'], "users/user"); - - /* Template readable? */ - if (preg_match('/r/', $acl)){ - $template_dn= $_POST['template']; - - foreach ($this->dns as $dn){ - $acl = $this->ui->get_permissions($_POST['template'], "users/user"); - if (preg_match('/w/', $acl)){ - $usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); - $usertab->adapt_from_template($template_dn, array("sn", "givenName", "uid")); - $usertab->save(); - unset ($usertab); - $usertab= NULL; - } else { - msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to modify object '%s'!"), $dn), ERROR_DIALOG); - } - } - } else { - msg_dialog::display(_("Permission error"), _("You have no permission to use this template!"), ERROR_DIALOG); - } - + 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); - /******************** - Delete MULTIPLE entries requested, display confirm dialog - ********************/ - - if ($s_action=="del_multiple" || $s_action == "del"){ - - if($s_action == "del"){ - - /* Get 'dn' from posted 'uid' */ - $ids = array($s_entry); - }else{ - $ids = $this->list_get_selected_items(); - } - - $this->dns = array(); - if(count($ids)){ - $disallowed = array(); - foreach($ids as $id){ - $dn = $this->list[$id]['dn']; - $acl = $this->ui->get_permissions($dn, "users/user"); - if(preg_match("/d/",$acl)){ - $this->dns[$id] = $dn; - }else{ - $disallowed[] = $dn; - } - } - - if(count($disallowed)){ - msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG); - } - - if(count($this->dns)){ - - /* Check locks */ - if ($user= get_multiple_locks($this->dns)){ - return(gen_locked_message($user,$this->dns)); - } - - $dns_names = array(); - foreach($this->dns as $dn){ - $dns_names[] = LDAP::fix($dn); - } - - add_lock($this->dns, $this->ui->dn); - - /* Lock the current entry, so nobody will edit it during deletion */ - $info = sprintf(msgPool::deleteInfo($dns_names,_("user"))); - - /* Lock the current entry, so nobody will edit it during deletion */ - $smarty->assign("info", msgPool::deleteInfo($dns_names)); - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); - } - } + 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()); } + } - /******************** - Delete MULTIPLE entries confirmed - ********************/ - - if(isset($_POST['delete_user_confirm'])){ + /*! \brief Intiates user creation. + * If we've user templates, then the user will be asked to use to use one. + * -> See 'templateContinue' for further handling. + */ + function newUserFromTemplate($action="",$target=array(),$all=array()) + { + // Call parent method, it knows whats to do, locking and so on ... + $str = management::newEntry($action,$target,$all); + if(!empty($str)) return($str); + + // Reset uid selection. + $this->got_uid= ""; + + // Use template if there are any of them + $templates = array(); + $templates['none']= _("none"); + $templates = array_merge($templates,$this->get_templates()); + + // We've templates, so preset the current template and display the input dialog. + if (count($templates)){ + $smarty = get_smarty(); + foreach(array("sn", "givenName", "uid", "got_uid") as $attr){ + $smarty->assign("$attr", ""); + } + $smarty->assign("template", array_pop($target)); + $smarty->assign("templates", $templates); + $smarty->assign("edit_uid", ""); + return($smarty->fetch(get_template_path('template.tpl', TRUE))); - /* Remove user by user and check acls before removeing them */ - foreach($this->dns as $key => $dn){ + // -> See 'templateContinue' for further handling! + } + } - $acl = $this->ui->get_permissions($dn, "users/user"); - if (preg_match('/d/', $acl)){ - /* Delete request is permitted, perform LDAP action */ - $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$dn); - $this->usertab->set_acl_base(); - $this->usertab->delete (); - unset ($this->usertab); - $this->usertab= NULL; - } else { - msg_dialog::display(_("Warning"),msgPool::permDelete($dn),WARNING_DIALOG); - if(isset($this->ui->uid)){ - new log("security","users/".get_class($this),$dn,array(),"Tried to trick deletion."); - } - } - } - /* Remove lock file after successfull deletion */ - $this->remove_lock(); - $this->dns = array(); - } + /*! \brief Intiates user creation. + * If we've user templates, then the user will be asked + * if he wants to use one. + * -> See 'templateContinue' for further handling. + */ + function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { - /******************** - Toggle lock status for user - ********************/ + // Call parent method, it manages everything, locking, object creation... + $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(); + $templates['none']= _("none"); + $templates = array_merge($templates,$this->get_templates()); + + // Display template selection + if (count($templates) > 1){ + $smarty = get_smarty(); - if($s_action == "toggle_lock_status" && isset($this->list[$s_entry])){ - - /* Get entry check current status */ - $val = $this->list[$s_entry]; - if (!preg_match("/w/",$this->ui->get_permissions($val['dn'],"users/password"))){ - msg_dialog::display(_("Account locking"), - _("You have no permission to change the lock status for this user!"),WARNING_DIALOG); - }else{ - $pwd = $val['userPassword'][0]; - $method = passwordMethod::get_method($pwd,$val['dn']); - $success= false; - if($method instanceOf passwordMethod){ - if($method->is_locked($this->config,$val['dn'])){ - $success= $method->unlock_account($this->config,$val['dn']); - }else{ - $success= $method->lock_account($this->config,$val['dn']); - } - - /* Check for success */ - if (!$success){ - $hn= $method->get_hash_name(); - if (is_array($hn)){ - $hn= $hn[0]; - } - msg_dialog::display(_("Account locking"), - sprintf(_("Password method '%s' does not support locking. Account has not been locked!"), $hn),WARNING_DIALOG); - } - }else{ - // Can't lock unknown methods. - } - + // Set default variables, normally empty. + foreach(array("sn", "givenName", "uid", "got_uid") as $attr){ + $smarty->assign($attr, ""); } + $smarty->assign("template", "none"); + $smarty->assign("templates", $templates); + $smarty->assign("edit_uid", ""); + return($smarty->fetch(get_template_path('template.tpl', TRUE))); + + // -> See 'templateContinue' for further handling! } + } - /******************** - Delete entry Canceled - ********************/ - /* Delete user canceled? */ - if (isset($_POST['delete_cancel'])){ + /* !\brief This method is called whenever a template selection was displayed. + * Here we act on the use selection. + * - Does the user want to create a user from template? + * - Create user without template? + * - Input correct, every value given and valid? + */ + function templateContinue() + { + // Get the list of available templates. + $templates = array(); + $templates['none']= _("none"); + $templates = array_merge($templates,$this->get_templates()); - /* Remove lock file after successfull deletion */ - $this->remove_lock(); - $this->dns = array(); + // Input validation, if someone wants to create a user from a template + // then validate the given values. + $message = array(); + if(!isset($_POST['template']) || (empty($_POST['template']))){ + $message[]= msgPool::invalid(_("Template")); + } + if(!isset($_POST['sn']) || (empty($_POST['sn']))){ + $message[]= msgPool::required(_("Name")); + } + if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){ + $message[]= msgPool::required(_("Given name")); } - /******************** - Edit entry finished (Save) + * 1 We've had input errors - Display errors and show input dialog again. ********************/ - /* Finish user edit is triggered by the tabulator dialog, so - the user wants to save edited data. Check and save at this - point. */ - if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->usertab->config))){ - - /* Check tabs, will feed message array */ - $this->usertab->last= $this->usertab->current; - $this->usertab->save_object(); - $message= $this->usertab->check(); - - /* Save, or display error message? */ - if (count($message) == 0){ + if (count($message) > 0){ + msg_dialog::displayChecks($message); - /* No errors. Go ahead and prepare to ask for a password - in case we're creating a new user. 'dn' will be 'new' - in this case. It is set to the correct value later. */ - if ($this->dn == "new"){ - $set_pass= 1; - } else { - $set_pass= 0; - } - - /* Save user data to ldap */ - if($this->usertab->save() == 1){ - return; - } - - if (!isset($_POST['edit_apply'])){ - /* User has been saved successfully, remove lock from LDAP. */ - if ($this->dn != "new"){ - $this->remove_lock(); - } - - /* In case of new users, ask for a password, skip this for templates */ - if (($set_pass || $this->usertab->password_change_needed()) && !$this->is_template){ - $this->dn = $this->usertab->dn; - return($smarty->fetch(get_template_path('password.tpl', TRUE))); - } - - unset ($this->usertab); - $this->usertab= NULL; - set_object_info(); + // Preset input fields with user input. + $smarty = get_smarty(); + foreach(array("sn", "givenName", "uid", "template") as $attr){ + if(isset($_POST[$attr])){ + $smarty->assign("$attr", get_post($attr)); }else{ - - /* Reinitialize tab */ - if($this->usertab instanceof tabs){ - $this->usertab->re_init(); - } + $smarty->assign("$attr", ""); } - } else { - /* Ok. There seem to be errors regarding to the tab data, - show message and continue as usual. */ - msg_dialog::displayChecks($message); } - } - - - /******************** - Create a new user,template, user from template - ********************/ - - /* Check selected options for template */ - if (isset($_POST['template_continue'])){ - $message = array(); - if(!isset($_POST['template']) || (empty($_POST['template']))){ - $message[]= msgPool::invalid(_("Template")); - } - if(!isset($_POST['sn']) || (empty($_POST['sn']))){ - $message[]= msgPool::required(_("Name")); - } - if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){ - $message[]= msgPool::required(_("Given name")); - } - - /* Show error message / continue editing */ - if (count($message) > 0){ - msg_dialog::displayChecks($message); - - foreach(array("sn", "givenName", "uid", "template") as $attr){ - if(isset($_POST[$attr])){ - $smarty->assign("$attr", $_POST[$attr]); - }else{ - $smarty->assign("$attr", ""); - } - } - $smarty->assign("templates",$this->templates); - $smarty->assign("got_uid",$this->got_uid); - $smarty->assign("edit_uid",false); - return($smarty->fetch(get_template_path('template.tpl', TRUE))); - - } + $smarty->assign("templates",$templates); + $smarty->assign("got_uid", $this->got_uid); + $smarty->assign("edit_uid",false); + return($smarty->fetch(get_template_path('template.tpl', TRUE))); } - /* New user/template request */ - if (($s_action=="create_user_from_tpl")||($s_action=="new") || ($s_action=="new_tpl")){ - /* By default we set 'dn' to 'new', all relevant plugins will - react on this. */ - $this->dn= "new"; - - $this->got_uid= ($this->config->get_cfg_value("idGenerator") == ""); - - /* Create new usertab object */ - $this->usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $this->dn); - $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase; - $this->usertab->set_acl_base($this->DivListUsers->selectedBase); - - /* Take care about templates */ - if ($s_action=="new_tpl"){ - $this->is_template= TRUE; - $this->usertab->set_template_mode (); - } else { - $this->is_template= FALSE; - } - - /* Use template if there are any of them */ - if ((count($this->templates) && ($s_action!='new_tpl'))||($s_action=="create_user_from_tpl")){ - foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){ - $smarty->assign("$attr", $this->$attr); - } - if ($s_action=="create_user_from_tpl"){ - $smarty->assign("template", $this->dn= $this->list[trim($s_entry)]['dn']); - } else { - $smarty->assign("template", "none"); - } - $smarty->assign("edit_uid", ""); - return($smarty->fetch(get_template_path('template.tpl', TRUE))); - } - } /******************** - Template selected continue edit + * 2 There was a template selected, now ask for the uid. ********************/ - /* Continue template editing */ - if ((isset($_POST['template_continue'])) && ($_POST['template'] != 'none') && (!isset($_POST['uid']))){ + if ($_POST['template'] != 'none' && !isset($_POST['uid'])){ + // Remember user input. + $smarty = get_smarty(); $this->sn = $_POST['sn']; $this->givenName = $_POST['givenName']; - /* Check for requred values */ - $message= array(); - if ($this->sn == "") { - $message[]= msgPool::required(_("Name")); - } - if ($this->givenName == "") { - $message[]= msgPool::required(_("Given name")); - } - - /* Check if dn is used */ + // Avoid duplicate entries, check if such a user already exists. $dn= preg_replace("/^[^,]+,/i", "", $_POST['template']); $ldap= $this->config->get_ldap_link(); $ldap->cd ($dn); $ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName")); if ($ldap->count () != 0){ - msgPool::duplicated(_("Name")); - } + msg_dialog::displayChecks(array(msgPool::duplicated(_("Name")))); + }else{ - /* Show error message / continue editing */ - if (count($message) > 0){ - msg_dialog::displayChecks($message); - } else { + // Preset uid field by using the idGenerator $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName); if ($this->config->get_cfg_value("idGenerator") != ""){ $uids= gen_uids ($this->config->get_cfg_value("idGenerator"), $attributes); @@ -877,154 +486,242 @@ class userManagement extends plugin $this->got_uid= true; } - foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){ + // Assign user input + foreach(array("sn", "givenName", "uid", "got_uid") as $attr){ $smarty->assign("$attr", $this->$attr); } if (isset($_POST['template'])){ $smarty->assign("template", $_POST['template']); } + $smarty->assign("templates",$templates); return($smarty->fetch(get_template_path('template.tpl', TRUE))); } + /******************** - No template selected continue edit + * 3 No template - Ok. Lets fill the data into the user object and skip templating here. ********************/ - - /* No template. Ok. Lets fill data into the normal user dialog */ - if (isset($_POST['template_continue']) && $_POST['template'] == 'none'){ + if ($_POST['template'] == 'none'){ foreach(array("sn", "givenName", "uid") as $attr){ if (isset($_POST[$attr])){ - $this->usertab->by_object['user']->$attr= $_POST[$attr]; + $this->tabObject->by_object['user']->$attr= $_POST[$attr]; } } + + // The user Tab object is already instantiated, so just go back and let the + // management class do the rest. + return(""); } /******************** - Template selected continue edit + * 4 Template selected and uid given - Ok, then lets adapt tempalte values. ********************/ + if(isset($_POST['uid'])){ - /* Finish template preamble */ - if (isset($_POST['template_continue']) && $_POST['template'] != 'none' && (isset($_POST['uid']))){ - - /* Move user supplied data to sub plugins */ + // Move user supplied data to sub plugins foreach(array("uid","sn","givenName") as $attr){ $this->$attr = $_POST[$attr]; - $this->usertab->$attr = $this->$attr; - $this->usertab->by_object['user']->$attr = $this->$attr; + $this->tabObject->$attr = $this->$attr; + $this->tabObject->by_object['user']->$attr = $this->$attr; } + // Adapt template values. $template_dn = $_POST['template']; - $this->usertab->adapt_from_template($template_dn, array("uid","cn","givenName","sn")); - $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/", '', $template_dn); - $this->usertab->by_object['user']->base= $template_base; + $this->tabObject->adapt_from_template($template_dn, array("uid","cn","givenName","sn")); + $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 + // management class do the rest. + return(""); } - - - /******************** - If no template was selected set base - ********************/ + } + + + /* !\brief This method applies a template to a set of users. + */ + function templatizeUsers($action="",$target=array(),$all=array()) + { + $this->dns = array(); + if(count($target)){ - if (isset($_POST['template_continue']) && ($_POST['template'] == 'none')){ - $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase; + // Get the list of available templates. + $templates = $this->get_templates(); + + // Check entry locking + foreach($target as $dn){ + if (($user= get_lock($dn)) != ""){ + $this->dn = $dn; + return(gen_locked_message ($user, $dn)); + } + $this->dns[] = $dn; + } + + // Display template + $smarty = get_smarty(); + $smarty->assign("templates", $templates); + return($smarty->fetch(get_template_path('templatize.tpl', TRUE))); } + } - /******************** - Display subdialog - ********************/ + /* !\brief This method is called whenever the templatize dialog was used. + */ + function templatizeContinue() + { + // Template readable? + $template= get_post('template'); + $acl = $this->ui->get_permissions($template, $this->aclCategory."/".$this->aclPlugin); + if (preg_match('/r/', $acl)){ + $tab = $this->tabClass; + foreach ($this->dns as $dn){ + + // User writeable + $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin); + if (preg_match('/w/', $acl)){ + $this->tabObject= new $tab($this->config, $this->config->data['TABS'][$this->tabType], $dn, $this->aclCategory); + $this->tabObject->adapt_from_template($template, array("sn", "givenName", "uid")); + $this->tabObject->save(); + } else { + msg_dialog::display(_("Permission error"), msgPool::permModify($dn), ERROR_DIALOG); + } + } + } else { + msg_dialog::display(_("Permission error"), msgPool::permView($template), ERROR_DIALOG); + } - /* Show tab dialog if object is present */ - if(isset($this->usertab->config)){ + // Cleanup! + $this->remove_lock(); + $this->closeDialogs(); + } - $display= $this->usertab->execute(); - /* Don't show buttons if tab dialog requests this */ - - $dia = FALSE; - if(isset($this->usertab->by_object[$this->usertab->current]->dialog)){ - $dia = $this->usertab->by_object[$this->usertab->current]->dialog; + /* !\brief Lock/unlock multiple users. + */ + function lockUsers($action,$target,$all) + { + if(!count($target)) return; + if($action == "lockUsers"){ + $this->lockEntry($action,$target, $all, "lock"); + }else{ + $this->lockEntry($action,$target, $all, "unlock"); + } + } + + + /* !\brief Locks/unlocks the given user(s). + */ + function lockEntry($action,$entry, $all, $type = "toggle") + { + + // Filter out entries we are not allowed to modify + $disallowed = array(); + $dns = array(); + foreach($entry as $dn){ + if (!preg_match("/w/",$this->ui->get_permissions($dn,"users/password"))){ + $disallowed[] = $dn; + }else{ + $allowed[] = $dn; + } + } + if(count($disallowed)){ + msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG); + } + + // Try to lock/unlock the rest of the entries. + $ldap = $this->config->get_ldap_link(); + foreach($allowed as $dn){ + $ldap->cat($dn, array('userPassword')); + if($ldap->count() == 1){ + + // We can't lock empty passwords. + $val = $ldap->fetch(); + if(!isset($val['userPassword'])){ + continue; } - if(!is_object($dia) && $dia != TRUE){ - if(($this->usertab instanceOf tabs || $this->usertab instanceOf plugin) && $this->usertab->read_only == TRUE){ - $display.= "
- -
"; - }else{ - $display.= "\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; - $display.= " \n"; + // Detect the password method and try to lock/unlock. + $pwd = $val['userPassword'][0]; + $method = passwordMethod::get_method($pwd,$val['dn']); + $success= true; + if($method instanceOf passwordMethod){ + if($type == "toggle"){ + if($method->is_locked($this->config,$val['dn'])){ + $success= $method->unlock_account($this->config,$val['dn']); + }else{ + $success= $method->lock_account($this->config,$val['dn']); + } + }elseif($type == "lock" && !$method->is_locked($this->config,$val['dn'])){ + $success= $method->lock_account($this->config,$val['dn']); + }elseif($type == "unlock" && $method->is_locked($this->config,$val['dn'])){ + $success= $method->unlock_account($this->config,$val['dn']); + } + + // Check if everything went fine. + if (!$success){ + $hn= $method->get_hash_name(); + if (is_array($hn)){ + $hn= $hn[0]; } - $display.= "\n"; - $display.= "
"; + msg_dialog::display(_("Account locking"), + sprintf(_("Password method '%s' does not support locking. Account (%s) has not been locked!"), + $hn,$dn),WARNING_DIALOG); } + }else{ + // Can't lock unknown methods. } - return ($display); + } } - - /* Check if there is a snapshot dialog open */ - $base = $this->DivListUsers->selectedBase; - if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){ - return($str); + } + + + /* !\brief This method returns a list of all available templates. + */ + function get_templates() + { + $templates= array(); + $ldap= $this->config->get_ldap_link(); + foreach ($this->config->departments as $key => $value){ + $acl = $this->ui->get_permissions($value,$this->aclCategory."/".$this->aclPlugin); + if (preg_match("/c/",$acl)){ + + // Search all templates from the current dn. + $ldap->cd (get_people_ou().$value); + $ldap->search ("(objectClass=gosaUserTemplate)", array("uid")); + if ($ldap->count() != 0){ + while ($attrs= $ldap->fetch()){ + $templates[$ldap->getDN()]= $attrs['uid'][0]." - ".LDAP::fix($key); + } + } + } } - - /* Return rendered main page */ - $this->DivListUsers->parent = $this; - $this->DivListUsers->execute(); + natcasesort ($templates); + reset ($templates); + return($templates); + } + - /* Add departments if subsearch is disabled */ - if(!$this->DivListUsers->SubSearch){ - $this->DivListUsers->AddDepartments($this->DivListUsers->selectedBase,4,1); + 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); } - $this->reload(); - $this->DivListUsers->setEntries($this->list); - - # FILTER Test ################################################# - ## Build filter - #if (!$this->filter) { - # $this->filter = new filter(get_template_path("user-filter.xml", true)); - # $this->filter->setObjectStorage(get_people_ou()); - #} - #$this->filter->update(); - #session::set('autocomplete', $this->filter); - #if (!$this->filter->isValid()){ - # msg_dialog::display(_("Filter error"), _("The filter is uncomplete!"), ERROR_DIALOG); - #} - - ## Build headpage - #if (!$this->headpage){ - # $this->headpage = new listing(get_template_path("user-list.xml", true)); - # $this->headpage->registerElementFilter("accountProperties", "userManagement::filterProperties"); - # $this->headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel"); - # $this->headpage->registerElementFilter("lockImage", "userManagement::filterLockImage"); - # $this->headpage->setFilter($this->filter); - #} - - ## Needs to be called before update! - #$action= $this->headpage->getAction(); - #if ($action['action'] != '') { - # echo "List detected action:"; - # print_a($action); - #} - - ## Refresh for filter - #$this->headpage->update(); - # - #return($this->headpage->render()); - ################################################### FILTER Test - - return($this->DivListUsers->Draw()); + + return ""; } static function filterLockImage($userPassword) { $image= "images/empty.png"; - if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){ if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){ $image= "images/lists/locked.png"; @@ -1032,7 +729,6 @@ class userManagement extends plugin $image= "images/lists/unlocked.png"; } } - return $image; } @@ -1040,23 +736,20 @@ class userManagement extends plugin static function filterLockLabel($userPassword) { $label= ""; - if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){ if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){ - $label= _("Unlock account"); + $label= _("Unlock account")."