diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index fbb89c73d5dd2ff7b40ca30d1b8e5910a959ca77..bcf05f4aca6a44941124b866700c68d61f579041 100644 (file)
"create_user_from_tpl" => "userfrom_tpl",
"change_pw" => "user_chgpw",
"editPaste" => "editPaste", "copy" => "copy",
- "cut" => "cut") as $act => $name){
+ "cut" => "cut",
+ "toggle_lock_status" => "toggle_lock_status" ) as $act => $name){
if (preg_match("/".$name.".*/", $key)){
$s_action= $act;
}
}
+
+ /********************
+ Toggle lock status for user
+ ********************/
+
+ if($s_action == "toggle_lock_status" && isset($this->list[$s_entry])){
+
+ /* Get entry check current status */
+ $val = $this->list[$s_entry];
+ $pwd = $val['userPassword'][0];
+
+ if(!preg_match("/^\{[^\}]/",$pwd)){
+ trigger_error("Can not deactivate user which is using clear password encryption.");
+ }else{
+
+ $locked = false;
+ if(preg_match("/^[^\}]*+\}!/",$pwd)){
+ $locked = true;
+ }
+
+ /* Create ldap array to update status */
+ $attrs = array("userPassword" => $pwd);
+ if($locked){
+ $attrs['userPassword'] = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$attrs['userPassword']);
+ }else{
+ $attrs['userPassword'] = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$attrs['userPassword']);
+ }
+
+ /* Write new status back to ldap */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($val['dn']);
+ $ldap->modify($attrs);
+ if($locked){
+ show_ldap_error($ldap->get_error(),_("Could not set user status from locked to unlocked."));
+ }else{
+ show_ldap_error($ldap->get_error(),_("Could not set user status from unlocked to locked."));
+ }
+ }
+ }
+
/********************
Edit existing entry
$ldap= $this->config->get_ldap_link(TRUE);
if ($SubSearch){
$ListTemp = get_list($filter, $this->ui->subtreeACL, $base,
- array("uid", "givenName", "sn", "objectClass"), GL_SUBSEARCH | GL_SIZELIMIT);
+ array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SUBSEARCH | GL_SIZELIMIT);
} else {
$base= get_people_ou().$base;
$ListTemp = get_list($filter, $this->ui->subtreeACL, $base,
- array("uid", "givenName", "sn", "objectClass"), GL_SIZELIMIT);
+ array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SIZELIMIT);
}
$SortTemp = array();
$List = array();
$SortTemp[$display] = $display;
}
}
- sort($SortTemp);
+ natcasesort($SortTemp);
reset($SortTemp);
$this->list = array();