Code

Hide tabs frames
[gosa.git] / plugins / admin / ogroups / class_ogroupManagement.inc
index 134aeaa8920bbcbc65bd7504ffa9392a684f00a5..728c79c510c3d24edba264b06760859c6d3a46c1 100644 (file)
@@ -113,37 +113,37 @@ class ogroupManagement extends plugin
 
     /* Only perform copy / paste if it is enabled
      */
-    if($this->CopyPasteHandler){
 
-      /* Paste copied/cutted object in here
-       */
-      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
-        $this->CopyPasteHandler->save_object();
-        $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
-        return($this->CopyPasteHandler->execute());
-      }
 
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "copy"){
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
-        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-        $objNew   =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
-        $this->CopyPasteHandler->Copy($obj,$objNew);
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Only perform copy&paste requests if it is enabled
+     */
+    /* Get 'dn' from posted 'uid' */
+    if(in_array_ics($s_action,array("editPaste","cut","copy")) || (isset($this->CopyPasteHandler) &&  $this->CopyPasteHandler->stillOpen())){
+
+      if(isset($this->ogrouplist[trim($s_entry)]['dn'])){
+        $dn= $this->ogrouplist[trim($s_entry)]['dn'];
+      }else{
+        $dn = $this->DivListOGroup->selectedBase;
       }
 
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "cut"){
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
-        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-        $this->CopyPasteHandler->Cut($obj);
+      $acl= get_permissions ($dn, $this->ui->subtreeACL);
+      $acl= get_module_permission($acl, "ogroup", $dn);
+
+      if($acl != "#all#"){
+        print_red (_("You are not allowed to execute this method!"));
+      }else{
+        /* Display the copy & paste dialog, if it is currently open */
+        $ret = $this->copyPasteHandling($s_action,$s_entry);
+        if($ret){
+          return($ret);
+        }
       }
     }
 
-
     /****************
       Create a new object group 
      ****************/
@@ -309,7 +309,7 @@ class ogroupManagement extends plugin
      ****************/
 
     /* Cancel dialogs */
-    if (isset($_POST['edit_cancel'])){
+    if ((isset($_POST['edit_cancel'])) && (isset($this->ogroup->dn))){
       del_lock ($this->ogroup->dn);
       unset ($this->ogroup);
       $this->ogroup= NULL;
@@ -456,6 +456,45 @@ class ogroupManagement extends plugin
     $this->DivListOGroup->save_object();
   }
 
+  
+  function copyPasteHandling($s_action,$s_entry)
+  {
+
+    if($this->CopyPasteHandler){
+
+      /* Paste copied/cutted object in here
+       */
+      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+        $this->CopyPasteHandler->save_object();
+        $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
+        return($this->CopyPasteHandler->execute());
+      }
+
+      /* Copy current object to CopyHandler
+       */
+      if($s_action == "copy"){
+        $this->CopyPasteHandler->Clear();
+        $dn       =   $this->ogrouplist[$s_entry]['dn'];
+        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+        $objNew   =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
+
+        $types_of_tabs = $obj->by_object['ogroup']->gosaGroupObjects;
+        $objNew->by_object['ogroup']->gosaGroupObjects = $types_of_tabs;    
+        $objNew->reload($types_of_tabs);
+
+        $this->CopyPasteHandler->Copy($obj,$objNew);
+      }
+
+      /* Copy current object to CopyHandler
+       */
+      if($s_action == "cut"){
+        $this->CopyPasteHandler->Clear();
+        $dn       =   $this->ogrouplist[$s_entry]['dn'];
+        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+        $this->CopyPasteHandler->Cut($obj);
+      }
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: