#!/usr/local/bin/perl # Delete multiple groups require './ldap-useradmin-lib.pl'; &ReadParse(); %glist = map { $_->{'group'}, $_ } &list_groups(); &error_setup($text{'gmass_err'}); foreach $name (split(/\0/, $in{'gd'})) { $group = $glist{$name}; if ($group) { &can_edit_group(\%access, $group) || &error(&text('gmass_egroup', $name)); push(@dlist, $group); } } @dlist || &error($text{'gmass_enone'}); &ui_print_header(undef, $text{'gmass_title'}, ""); if ($in{'confirmed'}) { foreach $group (@dlist) { # Show username print "",&text('gmass_doing', $group->{'group'}), "
\n"; print "\n"; } &webmin_log("delete", "group", $group->{'group'}, $group); &ui_print_footer("", $text{'index_return'}); } else { foreach $group (@dlist) { # check if this is anyone's primary group foreach $u (&list_users()) { if ($u->{'gid'} == $group->{'gid'}) { print "",&text('gmass_eprimary', $group->{'group'}, $u->{'user'}), "

\n"; &ui_print_footer("", $text{'index_return'}); exit; } } } # Ask if the user is sure print &ui_confirmation_form( "mass_delete_group.cgi", &text('gmass_sure', scalar(@dlist)), [ map { [ "gd", $_->{'group'} ] } @dlist ], [ [ "confirmed", $text{'gdel_del'} ] ], &ui_checkbox("others", 1, $text{'gdel_dothers'}, $mconfig{'default_other'}), ); &ui_print_footer("", $text{'index_return'}); }