Handle hostnames with upper-case letters
[webmin.git] / usermin / list_restrict.cgi
1 #!/usr/local/bin/perl
2 # list_restrict.cgi
3 # Display usermin per-user or per-group module restrictions
4
5 require './usermin-lib.pl';
6 $access{'restrict'} || &error($text{'acl_ecannot'});
7 &ui_print_header(undef, $text{'restrict_title'}, "");
8
9 print &text('restrict_desc', "edit_acl.cgi"),"<p>\n";
10
11 @usermods = &list_usermin_usermods();
12 if (@usermods) {
13         print "<a href='edit_restrict.cgi?new=1'>$text{'restrict_add'}",
14               "</a><br>\n";
15         print "<table border width=100%>\n";
16         print "<tr $tb> <td><b>$text{'restrict_who'}</b></td> ",
17               "<td><b>$text{'restrict_what'}</b></td> ",
18               "<td width=10><b>$text{'restrict_move'}</b></td> </tr>\n";
19         $i = 0;
20         foreach $u (@usermods) {
21                 print "<tr $cb>\n";
22                 print "<td nowrap><a href='edit_restrict.cgi?idx=$i'>",
23                   $u->[0] eq "*" ? $text{'restrict_all'} :
24                   $u->[0] =~ /^\@(.*)/ ?
25                         &text('restrict_group', "<tt>$1</tt>") :
26                   $u->[0] =~ /^\// ?
27                         &text('restrict_file', "<tt>$u->[0]</tt>") :
28                         "<tt>$u->[0]</tt>","</a></td>\n";
29                 $mods = join(" ", map { "<tt>$_</tt>" } @{$u->[2]});
30                 print "<td>",!$mods ? $text{'restrict_nomods'} :
31                              &text($u->[1] eq "+" ? 'restrict_plus' :
32                                    $u->[1] eq "-" ? 'restrict_minus' :
33                                                     'restrict_set',
34                                    $mods),"</td>\n";
35                 print "<td>";
36                 if ($u eq $usermods[@usermods-1]) {
37                         print "<img src=images/gap.gif>";
38                         }
39                 else {
40                         print "<a href='move.cgi?idx=$i&down=1'>",
41                               "<img src=images/down.gif border=0></a>";
42                         }
43                 if ($u eq $usermods[0]) {
44                         print "<img src=images/gap.gif>";
45                         }
46                 else {
47                         print "<a href='move.cgi?idx=$i&up=1'>",
48                               "<img src=images/up.gif border=0></a>";
49                         }
50                 print "</td> </tr>\n";
51                 $i++;
52                 }
53         print "</table>\n";
54         }
55 else {
56         print "<b>$text{'restrict_none'}</b><p>\n";
57         }
58 print "<a href='edit_restrict.cgi?new=1'>$text{'restrict_add'}</a><p>\n";
59
60 &ui_print_footer("", $text{'index_return'});
61