summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e3764c)
raw | patch | inline | side by side (parent: 5e3764c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 09:55:03 +0000 (09:55 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 09:55:03 +0000 (09:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11102 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_SnapShotDialog.inc | patch | blob | history | |
gosa-core/include/class_plugin.inc | patch | blob | history | |
gosa-core/include/class_userinfo.inc | patch | blob | history |
diff --git a/gosa-core/include/class_SnapShotDialog.inc b/gosa-core/include/class_SnapShotDialog.inc
index fb7cb1f79c172d42183ee7a3e67e7b4e28cac252..50b3ae29bd56c3acf0daa8421f6e0ed03e43f3bd 100644 (file)
$entry = preg_replace("/^RemoveSnapShot_/","",$name);
$entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
- /* Check if we are allowed to handle snapshots
- */
- if($ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
-
- $found = false;
- foreach($this->last_list as $t_stamp => $obj){
- if($obj['dn'] == $entry){
- $found = true;
- break;
- }
+ $found = false;
+ foreach($this->last_list as $t_stamp => $obj){
+ if($obj['dn'] == $entry){
+ $found = true;
+ break;
}
+ }
- if($found){
- $this->del_dn = $entry;
- $smarty= get_smarty();
- $smarty->assign("intro", sprintf(_("You're about to delete the snapshot '%s'."), @LDAP::fix($this->del_dn)));
- return($smarty->fetch (get_template_path('remove.tpl')));
- }
+ if($found){
+ $this->del_dn = $entry;
+ $smarty= get_smarty();
+ $smarty->assign("intro", sprintf(_("You're about to delete the snapshot '%s'."), @LDAP::fix($this->del_dn)));
+ return($smarty->fetch (get_template_path('remove.tpl')));
}
}
}
/* Remove snapshot */
if(isset($_POST['delete_confirm']) && !empty($this->del_dn)){
- if($ui->allow_snapshot_restore($this->del_dn,$this->parent->acl_module)){
- $this->remove_snapshot($this->del_dn);
- }
+ $this->remove_snapshot($this->del_dn);
$this->del_dn = "";
}
foreach($tmp as $key => $entry){
/* Check permissions */
- if($ui->allow_snapshot_restore($entry['dn'],$this->parent->acl_module)){
- $TimeStamp = $entry['gosaSnapshotTimestamp'][0];
- $list_of_elements[$TimeStamp] = $entry;
- }
+ $TimeStamp = $entry['gosaSnapshotTimestamp'][0];
+ $list_of_elements[$TimeStamp] = $entry;
}
/* Sort generated list */
index f038fbf56d858f51b120db60966f3be939cf08e9..1c7b2d87c7bd560171623c0e13a58d592e008047 100644 (file)
}
- function showSnapshotDialog($base,$baseSuffixe)
+ function showSnapshotDialog($base,$baseSuffixe,&$parent)
{
$once = true;
+ $ui = get_userinfo();
+ $this->parent = $parent;
+
+ if(!isset($this->acl_module)){
+ return("VERDAMMT");
+ }
+
foreach($_POST as $name => $value){
/* Create a new snapshot, display a dialog */
$once = false;
$entry = preg_replace("/^CreateSnapShotDialog_/","",$name);
$entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
- $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
- }
+ if(!empty($entry) && $ui->allow_snapshot_create($entry,$this->parent->acl_module)){
+ $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to create a snapshot for %s."),$entry),ERROR_DIALOG);
+ }
+ }
+
/* Restore a snapshot, display a dialog with all snapshots of the current object */
if(preg_match("/^RestoreSnapShotDialog_/",$name) && $once){
$once = false;
$entry = preg_replace("/^RestoreSnapShotDialog_/","",$name);
$entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
- $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
- $this->snapDialog->display_restore_dialog = true;
+ if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
+ $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
+ $this->snapDialog->display_restore_dialog = true;
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),ERROR_DIALOG);
+ }
}
/* Restore one of the already deleted objects */
if(((isset($_POST['menu_action']) && $_POST['menu_action'] == "RestoreDeletedSnapShot")
|| preg_match("/^RestoreDeletedSnapShot_/",$name)) && $once){
$once = false;
- $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;
+
+ if($ui->allow_snapshot_restore($base,$this->parent->acl_module)){
+ $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;
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$base),ERROR_DIALOG);
+ }
}
/* Restore selected snapshot */
$once = false;
$entry = preg_replace("/^RestoreSnapShot_/","",$name);
$entry = base64_decode(trim(preg_replace("/_[xy]$/","",$entry)));
- if(!empty($entry)){
+ if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
$this->restore_snapshot($entry);
$this->snapDialog = NULL;
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),ERROR_DIALOG);
}
}
}
index 3c9d363cbdebae28f17b431951621357453ec415..25d0d326596492f3c19250be42f52a8c8136de9d 100644 (file)
}
$r = $w = $c = TRUE;
foreach($object as $category){
- $w |= preg_match("/w/",$this->has_complete_category_acls($dn, $category));
- $c |= preg_match("/c/",$this->has_complete_category_acls($dn, $category));
- $r |= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
-# print_a(array($category => $w.$c.$r));
+ $w &= preg_match("/w/",$this->has_complete_category_acls($dn, $category));
+ $c &= preg_match("/c/",$this->has_complete_category_acls($dn, $category));
+ $r &= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
+# print_a(array($category => array($r.$w.$c)));
}
- return($r);
+ return($r && $w && $c);
}
*/
function allow_snapshot_create($dn, $object)
{
- $w = preg_match("/w/",$this->has_complete_category_acls($dn, $object));
- $c = preg_match("/c/",$this->has_complete_category_acls($dn, $object));
- $r = preg_match("/r/",$this->has_complete_category_acls($dn, $object));
-# print_a(array($object => $w.$c.$r));
- return($r && $w && $c) ;
+ if(!is_array($object)){
+ $object = array($object);
+ }
+ $r = $w = $c = TRUE;
+ foreach($object as $category){
+ $w &= preg_match("/w/",$this->has_complete_category_acls($dn, $category));
+ $c &= preg_match("/c/",$this->has_complete_category_acls($dn, $category));
+ $r &= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
+# print_a(array($category => array($r.$w.$c)));
+ }
+ return($r) ;
}