summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9a5ddd)
raw | patch | inline | side by side (parent: b9a5ddd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 14 Aug 2007 08:15:14 +0000 (08:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 14 Aug 2007 08:15:14 +0000 (08:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7054 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/users/class_divListUsers.inc | patch | blob | history | |
plugins/admin/users/class_userManagement.inc | patch | blob | history |
diff --git a/plugins/admin/users/class_divListUsers.inc b/plugins/admin/users/class_divListUsers.inc
index 2314a077af5408918435fdbf3c4dd9167b422577..2842145d4947e1fe8c031baa9c09d50412673cec 100644 (file)
$this->AddHeader(array("string"=>" ", "attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>_("Username")." / "._("Department")));
$this->AddHeader(array("string"=>_("Properties"), "attach" => "style='width:166px;'"));
- $this->AddHeader(array("string"=>_("Actions"), "attach" => "style='width:102px;border-right:0px;text-align:right;'"));
+ $this->AddHeader(array("string"=>_("Actions"), "attach" => "style='width:122px;border-right:0px;text-align:right;'"));
$this->AddCheckBox("ShowTemplates" ,_("Select to see template pseudo users") ,_("Show templates") , false);
$this->AddCheckBox("ShowFunctionalUsers",_("Select to see users that have only a GOsa object"),_("Show functional users") , true);
// Test Every Entry and generate divlist Array
foreach($list as $key => $val){
-
+
/* Create action icons */
$action = "";
$acl= get_permissions ($dn, $this->ui->subtreeACL);
$acl= get_module_permission($acl, "user", $dn);
+ /* Add deactivate status */
+ $lock_status = "";
+
+ if(isset($val['userPassword'][0]) && preg_match("/^\{[^\}]/",$val['userPassword'][0])){
+ if(preg_match("/^[^\}]*+\}!/",$val['userPassword'][0])){
+ $lock_status = "<input class='center' type='image' src='images/closedlock.png'
+ alt='"._("Deactivated")."' name='toggle_lock_status_%KEY%'>";
+ }else{
+ $lock_status = "<input class='center' type='image' src='images/openlock.png'
+ alt='"._("Active")."' name='toggle_lock_status_%KEY%'>";
+ }
+ }else{
+ $lock_status = "<img src='images/empty.png' alt=' ' class='center'>";
+ }
+
/* Append copy&paste icons if allowed */
if($acl == "#all#" && $this->parent->CopyPasteHandler){
$action .= "<input class='center' type='image'
name='user_chgpw_%KEY%' title='"._("Change password")."'>";
}
+ /* Add deactivate status if we are allowed to */
+ if (chkacl($acl, "lock_status") == ""){
+ $action.= $lock_status;
+ }
+
/* Add delete icon if delete user is allowed */
if (chkacl($acl, "delete") == ""){
$action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
$field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'");
$field3 = array("string" => $UseImg, "attach" => "style='width:166px;'");
$field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),
- "attach" => "style='width:102px;border-right:0px; text-align:right;'");
+ "attach" => "style='width:122px;border-right:0px; text-align:right;'");
/* Add to list */
$add = array($field1,$field2,$field3,$field4);
$this->AddElement($add);
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index fbb89c73d5dd2ff7b40ca30d1b8e5910a959ca77..8b3acec2e18eb9c600de5599433229e236f3a025 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();