Added feature to be able to remove users from groups automaticly

This commit is contained in:
jengo 2000-08-19 03:38:35 +00:00
parent 34b5e461ae
commit c34644200b
2 changed files with 54 additions and 26 deletions

View File

@ -11,17 +11,28 @@
/* $Id$ */ /* $Id$ */
if ($confirm) { $phpgw_flags = array("noheader" => True, "nonavbar" => True);
$phpgw_flags = array("noheader" => True, "nonavbar" => True);
}
if (! $group_id) if (! $group_id)
Header("Location: " . $phpgw->link("groups.php")); Header("Location: " . $phpgw->link("groups.php"));
$phpgw_flags["currentapp"] = "admin"; $phpgw_flags["currentapp"] = "admin";
include("../header.inc.php"); 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->query("select group_name from groups where group_id='$group_id'");
$phpgw->db->next_record(); $phpgw->db->next_record();
@ -29,6 +40,9 @@
$phpgw->db->query("select con,loginid from accounts where groups like '%$group_id%'"); $phpgw->db->query("select con,loginid from accounts where groups like '%$group_id%'");
if ($phpgw->db->num_rows()) { if ($phpgw->db->num_rows()) {
$phpgw->common->header();
$phpgw->common->navbar();
echo '<p><center>'; echo '<p><center>';
echo lang_admin("Sorry, the follow users are still a member of the group x",$group_name) echo lang_admin("Sorry, the follow users are still a member of the group x",$group_name)
. '<br>' . lang_admin("They must be removed before you can continue") . '<br>' . lang_admin("They must be removed before you can continue")
@ -40,10 +54,36 @@
echo '<tr><td><a href="' . $phpgw->link("editaccount.php","con=" . $phpgw->db->f("con")) . '">' . $phpgw->db->f("loginid") . '</a></tr></td>'; echo '<tr><td><a href="' . $phpgw->link("editaccount.php","con=" . $phpgw->db->f("con")) . '">' . $phpgw->db->f("loginid") . '</a></tr></td>';
} }
echo "</table></center>"; echo "</table></center>";
echo "<a href=\"" . $phpgw->link("deletegroup.php","group_id=" . $group_id . "&removeusers=True")
. "\">" . lang_admin("Remove all users from this group") . "</a>";
exit; 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();
?>
<center> <center>
<table border=0 with=65%> <table border=0 with=65%>
<tr colspan=2> <tr colspan=2>
@ -63,24 +103,4 @@
</center> </center>
<? <?
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
}
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"));
}

View File

@ -6,6 +6,14 @@
database lockups if the program executes some invailed SQL. database lockups if the program executes some invailed SQL.
- Moved around the directory layout. The include files and images are now - Moved around the directory layout. The include files and images are now
in the applications directory. 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 [08152000] - Fixed a problem with the calendar not showing the months in the users
langague preference. langague preference.