From: hickert Date: Thu, 27 Nov 2008 08:57:58 +0000 (+0000) Subject: Updated userManagement to use the new passwordMethods lock_account/unlock_account X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=353526568a6587674008f41a4754b0bb8dec21db;p=gosa.git Updated userManagement to use the new passwordMethods lock_account/unlock_account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13052 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 6d2e83c9e..945f60ebd 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -647,45 +647,24 @@ class userManagement extends plugin /* Get entry check current status */ $val = $this->list[$s_entry]; - $pwd = $val['userPassword'][0]; - - if (!preg_match("/w/",$this->ui->get_permissions($val['dn'],"users/password"))){ - - /* Missing permissions, show message */ - msg_dialog::display(_("Password change"),_("You have no permission to change the lock status for this user!"),WARNING_DIALOG); - + msg_dialog::display(_("Password change"), + _("You have no permission to change the lock status for this user!"),WARNING_DIALOG); }else{ - - 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']); + $pwd = $val['userPassword'][0]; + $method = passwordMethod::get_method($pwd,$val['dn']); + if($method instanceOf passwordMethod){ + if($method->is_locked($this->config,$val['dn'])){ + $method->unlock_account($this->config,$val['dn']); }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 (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $val['dn'], 0, get_class())); + $method->lock_account($this->config,$val['dn']); } + }else{ + // Can't lock unknown methods. } } } - /******************** Delete entry Canceled ********************/