From c88a02c4476d1d05c6ae2565ef45149a6a5fac52 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 6 Jan 2006 10:39:38 +0000 Subject: [PATCH] Added passwort setting for opengw accounts git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2422 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_glpi.inc | 85 +++++++++++++++++++ include/class_opengw.inc | 8 +- .../connectivity/class_opengwAccount.inc | 37 +++++++- plugins/personal/connectivity/opengw.tpl | 15 ++++ 4 files changed, 139 insertions(+), 6 deletions(-) diff --git a/include/class_glpi.inc b/include/class_glpi.inc index 592c5f781..0cb4b0009 100644 --- a/include/class_glpi.inc +++ b/include/class_glpi.inc @@ -933,6 +933,91 @@ class glpiDB{ } } + + /* Monitor handling + */ + function getMonitors() + { + if($this->is_connected){ + $qry= "SELECT * FROM glpi_monitors;"; + return($this->query($qry)); + + }else{ + echo "not connected"; + return(false); + } + } + + function updatedMonitor() + { + if($this->is_connected){ +// $qry= "SELECT * FROM glpi_monitors;"; +// return($this->query($qry)); + + }else{ + echo "not connected"; + return(false); + } + } + + function addMonitor() + { + if($this->is_connected){ +// $qry= "SELECT * FROM glpi_monitors;"; +// return($this->query($qry)); + + }else{ + echo "not connected"; + return(false); + } + } + + function removeMonitor($id) + { + if($this->is_connected){ + $qry= "DELETE FROM glpi_monitors WHERE ID=".$id.";"; + $this->query($qry); + }else{ + echo "not connected"; + return(false); + } + } + + function getMonitorTypes() + { + if($this->is_connected){ + $qry= "SELECT * FROM glpi_type_monitors;"; + return($this->query($qry)); + + }else{ + echo "not connected"; + return(false); + } + } + + function getLocationTypes() + { + if($this->is_connected){ + $qry= "SELECT * FROM glpi_dropdown_locations;"; + return($this->query($qry)); + + }else{ + echo "not connected"; + return(false); + } + } + + function getStateTypes() + { + if($this->is_connected){ + $qry= "SELECT * FROM glpi_dropdown_state;"; + return($this->query($qry)); + }else{ + echo "not connected"; + return(false); + } + } + } //$s = new glpiDB("vserver-01","glpi","tester","glpi"); //print_r($s->query("SELECT * FROM glpi_computers")); diff --git a/include/class_opengw.inc b/include/class_opengw.inc index 6ecf100a8..f803002c1 100755 --- a/include/class_opengw.inc +++ b/include/class_opengw.inc @@ -18,7 +18,7 @@ class ogw{ var $MAY = array( "salutation","firstname","description","degree", "birthday","sex","street","zip","country","zipcity", "state","name1","value_string","number","db_status", - "object_version","is_locked","LocationTeamID","TeamIDis"); + "object_version","is_locked","LocationTeamID","TeamIDis","password"); var $LastError = ""; var $option = ""; @@ -54,7 +54,7 @@ class ogw{ $ret = array(); $qry = "SELECT is_person,is_account,is_intra_account,is_extra_account, number,owner_id,object_version,company_id,template_user_id,is_locked, - name,firstname,description,salutation,login,degree,birthday,sex + name,firstname,description,salutation,login,degree,birthday,sex FROM person WHERE login='".$uid."';"; $res = $this->ogo->FetchAllRows($this->ogo->Query($qry)); $ret = $res[0]; @@ -265,7 +265,7 @@ class ogw{ $arr = array( "company_id","object_version","owner_id","template_user_id", "is_person","is_account","is_intra_account","is_extra_account", "number","description","is_locked","login","name","name","firstname", - "salutation","degree","birthday","sex","db_status"); + "salutation","degree","birthday","sex","db_status","password"); $this->info['company_id'] = $this->ogo->gen_id(); $this->info['userID'] = "OGo".$this->info['company_id']; foreach($arr as $attr){ @@ -403,7 +403,7 @@ class ogw{ $arr = array( "company_id","object_version","owner_id", "template_user_id","is_person","is_account","is_intra_account", "is_extra_account","number","description","is_locked","login","name", - "firstname","salutation","degree","birthday","sex","db_status"); + "firstname","salutation","degree","birthday","sex","db_status","password"); $this->info['company_id'] = $ist[0]['company_id']; $this->info['userID'] = "OGo".$this->info['company_id']; foreach($arr as $attr){ diff --git a/plugins/personal/connectivity/class_opengwAccount.inc b/plugins/personal/connectivity/class_opengwAccount.inc index 6b83bdbd6..9e9ce7f6d 100644 --- a/plugins/personal/connectivity/class_opengwAccount.inc +++ b/plugins/personal/connectivity/class_opengwAccount.inc @@ -15,6 +15,8 @@ class opengwAccount extends plugin var $attributes = array(); var $objectclasses = array(); + var $SetPassword = false; + /* Attribute mapping opengroupware->ldap */ var $attrsToUse = array( "salutation" =>"vocation", "name" =>"sn", @@ -33,6 +35,7 @@ class opengwAccount extends plugin var $handle = NULL; var $is_account = false; var $initialy_was_account = false; + var $OGWPassword = ""; function opengwAccount ($config, $dn= NULL) { @@ -125,7 +128,7 @@ class opengwAccount extends plugin $smarty->assign($ar,array()); } $smarty->assign("OGWstate"," disabled "); - foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount","is_account") as $ar){ + foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount","is_account","OGWPassword") as $ar){ $smarty->assign($ar,""); $smarty->assign($ar."CHK",""); $smarty->assign($ar."ACL"," disabled "); @@ -151,7 +154,7 @@ class opengwAccount extends plugin /* Show main page */ $smarty->assign("OGWstate"," disabled "); - foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount") as $ar){ + foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount","OGWPassword") as $ar){ $smarty->assign($ar."ACL",chkacl($this->acl,$ar)); } @@ -216,6 +219,19 @@ class opengwAccount extends plugin } } + if($this->SetPassword == false){ + if($_SESSION['js'] == 1){ + $smarty->assign("OGWPasswordACL"," disabled "); + }else{ + $smarty->assign("OGWPasswordACL",""); + } + $smarty->assign("OGWPassword",""); + $smarty->assign("OGWPasswordCHK"," "); + }else{ + $smarty->assign("OGWPasswordACL",""); + $smarty->assign("OGWPassword",$this->OGWPassword); + $smarty->assign("OGWPasswordCHK"," checked "); + } $display.= $smarty->fetch (get_template_path('opengw.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -237,6 +253,23 @@ class opengwAccount extends plugin /* get post data */ if($this->is_account){ + if(isset($_POST['SetPassword'])){ + $this->SetPassword =true; + }else{ + $this->SetPassword = false; + } + + if((isset($_POST['OGWPassword']))&&($this->SetPassword)){ + $this->OGWPassword = $_POST['OGWPassword']; + $pwd = new passwordMethodCrypt($this->config); + + $this->info['password'] = preg_replace("/^{crypt}/","",$pwd->generate_hash($_POST['OGWPassword'])); + }else{ + if(isset($this->info['password'])){ + unset($this->info['password']); + } + } + /* Get selected team chkboxes */ $this->info['TeamIDis'] = array(); foreach($_POST as $name => $value ){ diff --git a/plugins/personal/connectivity/opengw.tpl b/plugins/personal/connectivity/opengw.tpl index 5744875a9..fbda05dac 100644 --- a/plugins/personal/connectivity/opengw.tpl +++ b/plugins/personal/connectivity/opengw.tpl @@ -37,6 +37,21 @@ + + + + + + {t}Set password{/t}   + + + -- 2.30.2