#!/usr/local/bin/perl # Delete multiple groups require './user-lib.pl'; &ReadParse(); %access = &get_module_acl(); %glist = map { $_->{'group'}, $_ } &list_groups(); &error_setup($text{'gmass_err'}); foreach $name (split(/\0/, $in{'d'})) { $group = $glist{$name}; if ($group) { &can_edit_group(\%access, $group) || &error(&text('gmass_egroup', $name)); push(@dlist, $group); $delete_sys = $group if ($group->{'gid'} < 10 && (!$delete_sys || $user->{'gid'} < $delete_sys->{'gid'})); } } @dlist || &error($text{'gmass_enone'}); $access{'gdelete'} || &error($text{'gdel_egroup'}); &ui_print_header(undef, $text{'gmass_title'}, ""); # Check for deletion of system group if (!$config{'delete_root'} && $delete_sys) { print "
",&text('gmass_eroot', $delete_root->{'group'}),"
\n";
&ui_print_footer("", $text{'index_return'});
exit;
}
if ($in{'confirmed'}) {
foreach $group (@dlist) {
# Show username
print "",&text('gmass_doing', $group->{'group'}),"
\n";
print "
\n"; } else { print "$text{'gdel_done'}
\n";
}
}
# Delete from group file
&lock_user_files();
print "$text{'gdel_group'}
\n";
&set_group_envs($group, 'DELETE_GROUP');
$merr = &making_changes();
&error(&text('usave_emaking', "$merr")) if (defined($merr));
&delete_group($group);
&unlock_user_files();
&made_changes();
print "$text{'gdel_done'}
\n"; print "
\n"; &ui_print_footer("", $text{'index_return'}); exit; } } } # Ask if the user is sure print "
\n"; &ui_print_footer("", $text{'index_return'}); }