From c34644200b87e582753ca7dd2ac480bd074c8c53 Mon Sep 17 00:00:00 2001 From: jengo Date: Sat, 19 Aug 2000 03:38:35 +0000 Subject: [PATCH] Added feature to be able to remove users from groups automaticly --- admin/deletegroup.php | 72 +++++++++++++++++++++++++++---------------- doc/CHANGELOG | 8 +++++ 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/admin/deletegroup.php b/admin/deletegroup.php index 51e7147029..62ba215291 100755 --- a/admin/deletegroup.php +++ b/admin/deletegroup.php @@ -11,17 +11,28 @@ /* $Id$ */ - if ($confirm) { - $phpgw_flags = array("noheader" => True, "nonavbar" => True); - } + $phpgw_flags = array("noheader" => True, "nonavbar" => True); if (! $group_id) Header("Location: " . $phpgw->link("groups.php")); $phpgw_flags["currentapp"] = "admin"; include("../header.inc.php"); - // I would like to have an option to auto remove users from the group - if (($group_id) && (! $confirm)) { + + if ((($group_id) && ($confirm)) || $removeusers) { + if ($removeusers) { + $phpgw->db->query("select con,groups from accounts where groups like '%$group_id%'"); + while ($phpgw->db->next_record()) { + $groups[$phpgw->db->f("con")] = $phpgw->db->f("groups"); + } + + while ($user = each($groups)) { + $user[1] = ereg_replace(",$group_id,",",",$user[1]); + $phpgw->db->query("update accounts set groups='$user[1]' where con='$user[0]'"); + } + $confirm = True; + } + $phpgw->db->query("select group_name from groups where group_id='$group_id'"); $phpgw->db->next_record(); @@ -29,6 +40,9 @@ $phpgw->db->query("select con,loginid from accounts where groups like '%$group_id%'"); if ($phpgw->db->num_rows()) { + $phpgw->common->header(); + $phpgw->common->navbar(); + echo '

'; echo lang_admin("Sorry, the follow users are still a member of the group x",$group_name) . '
' . lang_admin("They must be removed before you can continue") @@ -40,10 +54,36 @@ echo '' . $phpgw->db->f("loginid") . ''; } echo "
"; + echo "link("deletegroup.php","group_id=" . $group_id . "&removeusers=True") + . "\">" . lang_admin("Remove all users from this group") . ""; exit; } - ?> + if ($confirm) { + $phpgw->db->query("select group_name from groups where group_id='$group_id'"); + $phpgw->db->next_record(); + $group_name = $phpgw->db->f("group_name"); + + $phpgw->db->query("delete from groups where group_id='$group_id'"); + + $sep = $phpgw->common->filesystem_sepeartor(); + + $basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep + . "groups" . $sep; + + if (! @rmdir($basedir . $group_name)) { + $cd = 38; + } else { + $cd = 32; + } + + Header("Location: " . $phpgw->link("groups.php","cd=$cd")); + } + } + + $phpgw->common->header(); + $phpgw->common->navbar(); + ?>
@@ -63,24 +103,4 @@ db->query("select group_name from groups where group_id='$group_id'"); - $phpgw->db->next_record(); - $group_name = $phpgw->db->f("group_name"); - $phpgw->db->query("delete from groups where group_id='$group_id'"); - - $sep = $phpgw->common->filesystem_sepeartor(); - - $basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep - . "groups" . $sep; - - if (! @rmdir($basedir . $group_name)) { - $cd = 38; - } else { - $cd = 32; - } - - Header("Location: " . $phpgw->link("groups.php","cd=$cd")); - } diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 9d935bbc47..1d9448868a 100755 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -6,6 +6,14 @@ database lockups if the program executes some invailed SQL. - Moved around the directory layout. The include files and images are now in the applications directory. + - You can now add permissions to a group, all users within that group + would be granted those permissions. + - Fixed parse errors and footer problems with the calendars printer + friendly version. + - Fixed a problem with the groups directory not being deleted. + - Fixed a problem with not being able to add users to a group. + - Fixed bad link in calendar + - Added feature to be able to remove users from a group automaticly [08152000] - Fixed a problem with the calendar not showing the months in the users langague preference.