From 1db56154c196818c9b9f227b89444d01bb8d44b9 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 3 Nov 2006 11:30:11 +0000 Subject: [PATCH] Fixed snap shot dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5007 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_SnapShotDialog.inc | 30 ++++++++++++++++++------------ include/class_plugin.inc | 12 ++++++++---- plugins/admin/users/main.inc | 1 + 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/include/class_SnapShotDialog.inc b/include/class_SnapShotDialog.inc index 957a0077c..4fc900d01 100755 --- a/include/class_SnapShotDialog.inc +++ b/include/class_SnapShotDialog.inc @@ -15,13 +15,23 @@ class SnapShotDialog extends plugin var $del_dn= ""; var $ui; var $acl; + var $dns = array(); + var $snap_shot_bases = array(); + function SnapShotDialog($config,$dn,$parent) { - plugin::plugin($config,$dn); - $this->parent = $parent; - $this->ui = get_userinfo(); + plugin::plugin($config,$dn); + $this->parent = $parent; + $this->ui = get_userinfo(); } + + + /* Show deleted snapshots from these bases */ + function set_snapshot_bases($bases) + { + $this->snap_shot_bases = $bases; + } /* Display snapshot dialog */ @@ -29,7 +39,7 @@ class SnapShotDialog extends plugin { plugin::execute(); $smarty = get_smarty(); - + $once = true; foreach($_POST as $name => $value){ if((preg_match("/^RemoveSnapShot_/",$name)) && ($once)){ @@ -38,10 +48,6 @@ class SnapShotDialog extends plugin $entry = preg_replace("/^RemoveSnapShot_/","",$name); $entry = base64_decode(preg_replace("/_[xy]$/","",$entry)); - $acl = get_permissions ($entry, $this->ui->subtreeACL); - $this->acl = get_module_permission($acl, "snapshot", $entry ); - - $this->del_dn = $entry; $smarty= get_smarty(); $smarty->assign("intro", sprintf(_("You're about to delete the snapshot '%s'."), @LDAP::fix($this->del_dn))); @@ -66,14 +72,14 @@ class SnapShotDialog extends plugin /* Should we only display all snapshots of already deleted objects or the snapshots for the given object dn */ $res = array(); + $tmp = array(); if($this->display_all_removed_objects){ - if(is_array($this->dn)){ - $tmp = array(); - foreach($this->dn as $dn){ + if(count($this->snap_shot_bases)){ + foreach($this->snap_shot_bases as $dn){ $tmp = array_merge($tmp,$this->getAllDeletedSnapshots($dn,true)); } }else{ - $tmp = $this->getAllDeletedSnapshots($this->dn,true); + $tmp = $this->getAllDeletedSnapshots($this->snap_shot_bases,true); } }else{ $tmp = $this->Available_SnapsShots($this->dn,true); diff --git a/include/class_plugin.inc b/include/class_plugin.inc index af92fbe4f..9f92c624b 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -1123,15 +1123,18 @@ class plugin function remove_snapshot($dn) { - $ui = get_userinfo(); - - if($this->acl_is_removeable()){ + $ui = get_userinfo(); + $old_dn = $this->dn; + $this->dn = $dn; + + if($this->acl_is_removeable() && $this->acl_is_createable()){ $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!")); } + $this->dn = $old_dn; } @@ -1352,7 +1355,8 @@ class plugin /* 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; } diff --git a/plugins/admin/users/main.inc b/plugins/admin/users/main.inc index 128417a01..d545835f7 100644 --- a/plugins/admin/users/main.inc +++ b/plugins/admin/users/main.inc @@ -30,6 +30,7 @@ if ($remove_lock){ if (!isset($_SESSION['userManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $_SESSION['userManagement']= new userManagement ($config, $_SESSION['ui']); + $_SESSION['userManagement']->set_acl_category("users"); } $userManagement= $_SESSION['userManagement']; $userManagement->save_object(); -- 2.30.2