Code

All snapshots listed can be deleted. Else they weren't shown.
[gosa.git] / include / class_plugin.inc
index 04f89717e90812cfc716605cd912f1ab783f8ca2..c32eca5f0c17daddceda8a87c5c0b04ff6cf9899 100644 (file)
@@ -222,6 +222,8 @@ class plugin
    */
   function execute()
   {
+    gosa_log("ACL ".get_class($this)." - ".$this->acl_category." - ".$this->acl_base);
+
     /* This one is empty currently. Fabian - please fill in the docu code */
     $_SESSION['current_class_for_help'] = get_class($this);
     /* Reset Lock message POST/GET check array, to prevent perg_match errors*/
@@ -913,7 +915,9 @@ class plugin
     }
     $todo[] = "is_account";
     foreach($todo as $var){
-      $this->$var = $source->$var;
+      if (isset($source->$var)){
+        $this->$var= $source->$var;
+      }
     }
   }
 
@@ -1121,18 +1125,13 @@ class plugin
 
   function remove_snapshot($dn)
   {
-echo "FIXME: remove_snapshot uses old acl's<br>";
-    $ui   = get_userinfo();
-    $acl  = get_permissions ($dn, $ui->subtreeACL);
-    $acl  = get_module_permission($acl, "snapshot", $dn);
-
-    if (chkacl($this->acl, "delete") == ""){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->rmdir_recursive($dn);
-    }else{
-      print_red (_("You are not allowed to delete this snapshot!"));
-    }
+    $ui       = get_userinfo();
+    $old_dn   = $this->dn; 
+    $this->dn = $dn;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->rmdir_recursive($dn);
+    $this->dn = $old_dn;
   }
 
 
@@ -1353,7 +1352,8 @@ echo "FIXME: remove_snapshot uses old acl's<br>";
       /* Restore one of the already deleted objects */
       if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
         $once = false;
-        $this->snapDialog = new SnapShotDialog($this->config,$baseSuffixe,$this);
+        $this->snapDialog = new SnapShotDialog($this->config,"",$this);
+        $this->snapDialog->set_snapshot_bases($baseSuffixe);
         $this->snapDialog->display_restore_dialog      = true;
         $this->snapDialog->display_all_removed_objects  = true;
       }
@@ -1467,11 +1467,11 @@ echo "FIXME: remove_snapshot uses old acl's<br>";
 
   /* Get all allowed bases to move an object to or to create a new object.
      Idepartments also contains all base departments which lead to the allowed bases */
-  function acl_get_bases($category = "")
+  function get_allowed_bases($category = "")
   {
     $ui = get_userinfo();
     $deps = array();
+
     /* Set category */ 
     if(empty($category)){
       $category = $this->acl_category.get_class($this);
@@ -1491,7 +1491,13 @@ echo "FIXME: remove_snapshot uses old acl's<br>";
       echo "No default base found. ".$this->base."<br> ";
     }
 
+    $cat_bases = $ui->get_module_departments(preg_replace("/\/.*$/","",$category));
     foreach($this->config->idepartments as $dn => $name){
+      
+      if(!in_array_ics($dn,$cat_bases)){
+        continue;
+      }
+      
       $acl = $ui->get_permissions($dn,$category);
       if($new && preg_match("/c/",$acl)){
         $deps[$dn] = $name;