Code

Added attributes to list of acls
[gosa.git] / plugins / personal / connectivity / class_opengwAccount.inc
index 042c2b9e0625237510e314823d428508364f16d3..02b075d56e93147b24c9f892f09c76ade1f972dd 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)
        {
@@ -64,7 +67,11 @@ class opengwAccount extends plugin
                        if($this->handle->connected){
 
                                /* Set login name, to check if this is_account */
-                               $this->handle->info['login'] = $this->attrs['uid'][0];
+                               if(isset($this->attrs['uid'][0])){
+                                       $this->handle->info['login'] = $this->attrs['uid'][0];
+                               }else{
+                                       $this->handle->info['login'] = ""; 
+                               }
 
                                /* If this is account get data from database first */
                                if($this->handle->CheckExistence()){
@@ -121,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 ");
@@ -147,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));
                                        }
 
@@ -212,6 +219,21 @@ 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);
        }
@@ -233,6 +255,25 @@ 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 ){
@@ -285,6 +326,11 @@ class opengwAccount extends plugin
                }
        }
 
+  
+  function PrepareForCopyPaste($src){
+    // Nothing to do, because this object can't be copied ... yet
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>