3 # Find a group with a certain name and re-direct to its editing form
5 require './dhcpd-lib.pl';
7 $in{'group'} || &error($text{'lookup_egroupname'});
9 # Recursively find groups
10 $conf = &get_config();
11 @groups = &find_recursive("group", $conf);
14 %access = &get_module_acl();
15 foreach $g (@groups) {
16 local $can_view = &can('r', \%access, $g);
17 next if !$can_view && $access{'hide'};
18 local @opts = &find("option", $g->{'members'});
19 local ($dn) = grep { $_->{'values'}->[0] eq 'domain-name' } @opts;
20 if (&search_re($g->{'values'}->[0], $in{'group'}) ||
21 $dn && &search_re($dn->{'values'}->[1], $in{'group'})) {
27 # Go to the group or show an error
29 ($gidx, $uidx, $sidx) = &find_parents($group);
30 &redirect("edit_group.cgi?idx=$group->{'index'}".
31 (defined($gidx) ? "&gidx=$gidx" : "").
32 (defined($uidx) ? "&uidx=$uidx" : "").
33 (defined($sidx) ? "&sidx=$sidx" : ""));
36 &error(&text('lookup_egroup', $in{'group'}));