From a6694375dfde33a9e293f7b85eea4a49a7442fbf Mon Sep 17 00:00:00 2001
From: hickert ";
+ foreach($this->dns as $dn){
+ add_lock ($dn, $this->ui->dn);
+ $dns_names .= $dn."\n";
+ }
+ $dns_names .="
";
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("warning", sprintf(_("You're about to delete the following fai object(s) %s"), @LDAP::fix($dns_names)));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. Users should be deleted. */
+ if (isset($_POST['delete_multiple_fai_object_confirm'])){
+
+ /* Find out more about the object type */
+ $ldap = $this->config->get_ldap_link();
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $ldap->cat($dn, array('objectClass'));
+ $attrs = $ldap->fetch();
+ $type = $this->get_type($attrs);
+
+ $acl = $this->ui->get_permissions($dn,"fai/".$type[1]);
+ if(preg_match("/d/",$acl)){
+
+ $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
+ $this->dialog->set_acl_base($dn);
+ $this->dialog->by_object[$type[1]]->remove_from_parent ();
+ unset ($this->dialog);
+ gosa_log ("FAI class '".$dn."' has been tagged as removed");
+ $this->dialog= NULL;
+ $to_del = clean_up_releases($dn);
+ save_release_changes_now();
+
+ foreach($to_del as $dn){
+ $ldap->rmdir_recursive($dn);
+ gosa_log(sprintf(_("Release cleanup : Removing object (tagged as remvoed) that is no longer in use '%s'."),$dn));
+ }
+
+ } else {
+
+ /* Normally this shouldn't be reached, send some extra
+ logs to notify the administrator */
+ print_red (_("You are not allowed to delete this component!"));
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
+ "deletion.");
+ }
+
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries Canceled
+ ********************/
+
+ /* Remove lock */
+ if(isset($_POST['delete_multiple_fai_object_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/****************
Delete aborted
****************/
@@ -658,7 +757,7 @@ class faiManagement extends plugin
/* Display dialog with system list */
$this->DivListFai->parent = $this;
$this->DivListFai->execute();
- $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4);
+ $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1);
$this->reload();
$this->DivListFai->setEntries($this->objects);
return($this->DivListFai->Draw());
@@ -695,9 +794,21 @@ class faiManagement extends plugin
}
return ($ret);
}
-
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+
+
/* reload list of objects */
function reload()
{
diff --git a/plugins/admin/fai/remove.tpl b/plugins/admin/fai/remove.tpl
index 947e2c26e..10bf93dc5 100644
--- a/plugins/admin/fai/remove.tpl
+++ b/plugins/admin/fai/remove.tpl
@@ -12,7 +12,13 @@
- - - +{if $multiple} + + + +{else} + + + +{/if}
-- 2.30.2