Code

Made connectivity kolabAccount compatible with new acls
[gosa.git] / plugins / personal / connectivity / class_opengwAccount.inc
index 042c2b9e0625237510e314823d428508364f16d3..1ca0f5163c049e11792e59e0b01064f69fbfb171 100644 (file)
@@ -6,15 +6,12 @@ class opengwAccount extends plugin
        var $plHeadline       = "Opengroupware account";
        var $plDescription    = "This does something";
 
-       /* CLI vars */
-       var $cli_summary      = "Manage users webdav account";
-       var $cli_description  = "Some longer text\nfor help";
-       var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
        /* attribute list for save action */
        var $attributes       = array();
        var $objectclasses    = array();
 
+  var $SetPassword   = false;
+
        /* Attribute mapping opengroupware->ldap  */
        var $attrsToUse    = array( "salutation"  =>"vocation",
                        "name"        =>"sn",
@@ -33,6 +30,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 +62,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 +123,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 +149,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 +214,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 +250,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 +321,30 @@ class opengwAccount extends plugin
                }
        }
 
+  
+  function PrepareForCopyPaste($src){
+    // Nothing to do, because this object can't be copied ... yet
+  }
+
+
+ /* Return plugin informations for acl handling 
+      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */  
+  function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Opengroupware"),
+          "plDescription"   => _("Open groupware account settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("connectivity"),
+          "plPriority"      => 3,                                 // Position in tabs
+          "plSection"       => "personal",                        // This belongs to personal
+          "plCategory"      => array("gosaAccount"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "opengwAccount"   => "!!! FIXME "._("Open groupware account"))
+          ));
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>