Code

Fixed department removal
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Dec 2009 17:14:01 +0000 (17:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Dec 2009 17:14:01 +0000 (17:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14990 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/departments/class_departmentManagement.inc
gosa-core/plugins/admin/departments/tabs_department.inc

index ac40ce0629b5351a7497c663b7cdb23f05460b31..136c2393541962795f2fb5514a5cb2ee3ccfb6b9 100644 (file)
@@ -107,6 +107,54 @@ class departmentManagement extends management
   }
 
 
+
+  function removeEntryConfirmed($action="",$target=array(),$all=array(),
+      $altTabClass="",$altTabType="",$altAclCategory="")
+  {
+    $types= $this->get_support_departments();
+    $headpage = $this->getHeadpage();
+
+    $tabType = $this->tabType;
+    $tabClass = $this->tabClass;
+    $aclCategory = $this->aclCategory;
+    if(!empty($altTabClass)) $tabClass = $altTabClass;
+    if(!empty($altTabType)) $tabType = $altTabType;
+    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel confirmed!");
+
+    foreach($this->dns as $key => $dn){
+
+      // Check permissions, are we allowed to remove this object?
+      $type = $headpage->getType($dn);
+      $tabType = $types[$type]['TAB'];
+    
+      $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
+      if(preg_match("/d/",$acl)){
+
+        // Delete the object
+        $this->dn = $dn;
+        $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory, true, true);
+        $this->tabObject->set_acl_base($this->dn);
+        $this->tabObject->delete ();
+        $this->tabObject->parent = &$this;
+
+        // Remove the lock for the current object.
+        del_lock($this->dn);
+      } else {
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
+        new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+    }
+
+    // Cleanup
+    $this->remove_lock();
+    $this->closeDialogs();
+  }
+
+
+
+
   // Overriden save handler - We've to take care about the department tagging here.
   protected function saveChanges()
   {
index bac1988cc1d64ab0df57d65244fa60eba9adfd01..1c37179d2517d4737cbe51ebafff3339ccf76be8 100644 (file)
@@ -42,7 +42,9 @@ class deptabs extends tabs
 
     /* Add references/acls/snapshots */
     $this->addSpecialTabs();
-    $this->by_object['acl']->skipTagging= TRUE;
+    if(isset($this->by_object['acl'])){
+      $this->by_object['acl']->skipTagging= TRUE;
+    }
   }
 
   function check($ignore_account= FALSE)