Handle hostnames with upper-case letters
[webmin.git] / burner / acl_security.pl
1
2 do 'burner-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the acl module
6 sub acl_security_form
7 {
8 print "<tr> <td><b>$text{'acl_create'}</b></td> <td>\n";
9 printf "<input type=radio name=create value=1 %s> $text{'yes'}\n",
10         $_[0]->{'create'} ? 'checked' : '';
11 printf "<input type=radio name=create value=0 %s> $text{'no'}</td>\n",
12         $_[0]->{'create'} ? '' : 'checked';
13
14 print "<td><b>$text{'acl_edit'}</b></td> <td>\n";
15 printf "<input type=radio name=edit value=1 %s> $text{'yes'}\n",
16         $_[0]->{'edit'} ? 'checked' : '';
17 printf "<input type=radio name=edit value=0 %s> $text{'no'}</td> </tr>\n",
18         $_[0]->{'edit'} ? '' : 'checked';
19
20 print "<tr> <td><b>$text{'acl_global'}</b></td> <td>\n";
21 printf "<input type=radio name=global value=1 %s> $text{'yes'}\n",
22         $_[0]->{'global'} ? 'checked' : '';
23 printf "<input type=radio name=global value=0 %s> $text{'no'}</td>\n",
24         $_[0]->{'global'} ? '' : 'checked';
25 print "</tr>\n";
26
27 print "<tr> <td valign=top><b>$text{'acl_profiles'}</b></td>\n";
28 print "<td colspan=3>\n";
29 printf "<input type=radio name=all value=1 %s> %s\n",
30         $_[0]->{'profiles'} eq "*" ? "checked" : "", $text{'acl_all'};
31 printf "<input type=radio name=all value=0 %s> %s<br>\n",
32         $_[0]->{'profiles'} eq "*" ? "" : "checked", $text{'acl_sel'};
33 print "<select name=profiles multiple size=5>\n";
34 local $p;
35 local %can = map { $_, 1 } split(/\s+/, $_[0]->{'profiles'});
36 foreach $p (&list_profiles()) {
37         printf "<option value=%s %s>%s (%s)\n",
38                 $p->{'id'}, $can{$p->{'id'}} ? "selected" : "",
39                 $text{'index_type'.$p->{'type'}},
40                 $p->{'type'} == 1 ? $p->{'iso'} :
41                 $p->{'type'} == 4 ? $p->{'sdesc'} : $p->{'source_0'}.
42                                             ($p->{'source_1'} ? ", ..." : "");
43         }
44 print "</select></td> </tr>\n";
45
46 print "<tr> <td><b>$text{'acl_dirs'}</b></td> <td colspan=2>\n";
47 printf "<input name=dirs size=40 value='%s'></td> </tr>\n",
48         $_[0]->{'dirs'};
49 }
50
51 # acl_security_save(&options)
52 # Parse the form for security options for the acl module
53 sub acl_security_save
54 {
55 $_[0]->{'create'} = $in{'create'};
56 $_[0]->{'edit'} = $in{'edit'};
57 $_[0]->{'global'} = $in{'global'};
58 $_[0]->{'profiles'} = $in{'all'} ? "*" :
59                         join(" ", split(/\0/, $in{'profiles'}));
60 $_[0]->{'dirs'} = $in{'dirs'};
61 }
62