Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / list_users.cgi
1 #!/usr/bin/perl
2 # list_users.cgi
3 # Show all Webmin users with access to this module only
4
5 require './itsecur-lib.pl';
6 &foreign_require("acl", "acl-lib.pl");
7 &can_use_error("users");
8 &header($text{'users_title'}, "",
9         undef, undef, undef, undef, &apply_button());
10 print "<hr>\n";
11
12 # Work out which users have access to this module
13 @users = &acl::list_users();
14 foreach $u (@users) {
15         @m = @{$u->{'modules'}};
16         if ($u->{'name'} ne "root" &&
17             &indexof($module_name, @m) >= 0) {
18                 push(@musers, $u);
19                 }
20         }
21
22 #print "$text{'users_desc'}<p>\n";
23 $edit = &can_edit("users");
24 if (@musers) {
25         print "<a href='edit_user.cgi?new=1'>$text{'users_add'}</a><br>\n"
26                 if ($edit);
27         print "<table border>\n";
28         print "<tr $tb> ",
29               "<td><b>$text{'users_name'}</b></td> ",
30               "<td><b>$text{'users_ips'}</b></td> ",
31               "<td><b>$text{'users_enabled'}</b></td> ",
32               "</tr>\n";
33         foreach $u (@musers) {
34                 print "<tr $cb>\n";
35                 print "<td><a href='edit_user.cgi?",
36                       "name=$u->{'name'}'>$u->{'name'}</a></td>\n";
37                 print "<td>\n";
38                 if ($u->{'allow'}) {
39                         print &text('users_allow', $u->{'allow'});
40                         }
41                 elsif ($u->{'deny'}) {
42                         print &text('users_deny', $u->{'deny'});
43                         }
44                 else {
45                         print $text{'users_all'};
46                         }
47                 print "</td>\n";
48                 print "<td>",$u->{'pass'} =~ /^\*LK\*/ ? $text{'rule_no'} : $text{'rule_yes'},"</td>\n";
49                 %uaccess = &get_module_acl($u->{'name'});
50                 print "</tr>\n";
51                 }
52         print "</table>\n";
53         }
54 else {
55         print "<b>$text{'users_none'}</b><p>\n";
56         }
57 print "<a href='edit_user.cgi?new=1'>$text{'users_add'}</a><p>\n"
58         if ($edit);
59
60 print "<hr>\n";
61 &footer("", $text{'index_return'});