From 50f59430f96ad744d5e4ed7c68725f52698a13eb 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("info", sprintf(_("You're about to delete the following group(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_group_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $acl = $this->ui->get_permissions($dn, "users/user");
+ if (preg_match('/d/', $acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$dn);
+ $this->usertab->set_acl_base();
+ $this->usertab->delete ();
+ gosa_log ("User object '".$dn."' has been removed");
+ unset ($this->usertab);
+ $this->usertab= NULL;
+ } else {
+ print_red (sprintf(_("You are not allowed to delete the user '%s'!"),$dn));
+ if(isset($this->ui->uid)){
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick user deletion.");
+ }
+ }
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. Users should be deleted. */
+ if (isset($_POST['delete_multiple_groups_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ /* Load permissions for selected 'dn' and check if
+ we're allowed to remove this 'dn' */
+ $acl = $this->ui->get_permissions($this->dn,"groups/group");
+ if(preg_match("/d/",$acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
+ $this->grouptab->set_acl_base($this->dn);
+ $this->grouptab->delete ();
+ gosa_log ("Group object'".$this->dn."' has been removed");
+ unset ($this->grouptab);
+ $this->grouptab= NULL;
+
+ } else {
+
+ /* Normally this shouldn't be reached, send some extra
+ logs to notify the administrator */
+ print_red (_("You are not allowed to delete this group!"));
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick group 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_user_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/********************
Delete group
********************/
@@ -241,6 +358,7 @@ class groupManagement extends plugin
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
$smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
+ $smarty->assign("multiple", false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
@@ -352,7 +470,7 @@ class groupManagement extends plugin
/* Add departments if subsearch is disabled */
if(!$this->DivListGroup->SubSearch){
- $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4);
+ $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
}
$this->reload ();
$this->DivListGroup->setEntries($this->grouplist);
@@ -367,6 +485,18 @@ class groupManagement extends plugin
}
+ 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);
+ }
+
function reload($CreatePosixsList=false)
{
diff --git a/plugins/admin/groups/remove.tpl b/plugins/admin/groups/remove.tpl
index 1f3ff8b96..c91b28f7f 100644
--- a/plugins/admin/groups/remove.tpl
+++ b/plugins/admin/groups/remove.tpl
@@ -11,8 +11,17 @@
+ + {if $multiple} + + + + {else} + {/if} + +
-- 2.30.2