Code

Added passwort setting for opengw accounts
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Jan 2006 10:39:38 +0000 (10:39 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Jan 2006 10:39:38 +0000 (10:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2422 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_glpi.inc
include/class_opengw.inc
plugins/personal/connectivity/class_opengwAccount.inc
plugins/personal/connectivity/opengw.tpl

index 592c5f7819bd989eb589d89dde34db75ac2c8b66..0cb4b00090dc68cf6b5db28e98475398668b5a49 100644 (file)
@@ -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"));
index 6ecf100a82b692f842a45401ce994f025d0d5260..f803002c113ea55d2d811ac086876abdfcd18486 100755 (executable)
@@ -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){
index 6b83bdbd6c0e2dd05d49f3f31a2ce9aee7e79c2c..9e9ce7f6dd424053425fcec2e43b2c7172eae901 100644 (file)
@@ -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 ){
index 5744875a91b016032d5065137c1b3ab0e0472476..fbda05dac48feb939258ae9bf2db3f29aa15c9ca 100644 (file)
                                                <input type="checkbox" value="1" name="is_locked" {$is_lockedCHK}  
                                                   {if $is_lockedACL!="" || $OGWstate!=""}
                                 disabled
+                           {/if}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <input type="checkbox" name="SetPassword" value="1" {$OGWPasswordCHK} onClick="changeState('OGWPassword');" 
+                                                  {if $OGWstate!=""}
+                                disabled
+                           {/if}>
+                                               {t}Set password{/t} &nbsp; 
+                                       </td>
+                                       <td valign="top">
+                                               <input type="text" name="OGWPassword" value="{$OGWPassword}" id="OGWPassword" 
+                                                  {if $OGWPasswordACL!="" || $OGWstate!=""}
+                                disabled
                            {/if}>
                                        </td>
                                </tr>