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,30 +54,11 @@
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;
} }
?>
<center>
<table border=0 with=65%>
<tr colspan=2>
<td align=center>
<?php echo lang_admin("Are you sure you want to delete this group ?"); ?>
<td>
</tr>
<tr>
<td>
<a href="<?php echo $phpgw->link("groups.php") . "\">" . lang_common("No") . "</a>"; ?>
</td>
<td>
<a href="<?php echo $phpgw->link("deletegroup.php","group_id=$group_id&confirm=true") . "\">" . lang_common("Yes") . "</a>"; ?>
</td>
</tr>
</table>
</center>
<?
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
}
if ($confirm) { if ($confirm) {
$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();
@ -84,3 +79,28 @@
Header("Location: " . $phpgw->link("groups.php","cd=$cd")); Header("Location: " . $phpgw->link("groups.php","cd=$cd"));
} }
}
$phpgw->common->header();
$phpgw->common->navbar();
?>
<center>
<table border=0 with=65%>
<tr colspan=2>
<td align=center>
<?php echo lang_admin("Are you sure you want to delete this group ?"); ?>
<td>
</tr>
<tr>
<td>
<a href="<?php echo $phpgw->link("groups.php") . "\">" . lang_common("No") . "</a>"; ?>
</td>
<td>
<a href="<?php echo $phpgw->link("deletegroup.php","group_id=$group_id&confirm=true") . "\">" . lang_common("Yes") . "</a>"; ?>
</td>
</tr>
</table>
</center>
<?
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");

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.