Handle hostnames with upper-case letters
[webmin.git] / passwd / acl_security.pl
1
2 require 'passwd-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the passwd module
6 sub acl_security_form
7 {
8 print "<tr> <td valign=top><b>$text{'acl_users'}</b></td> <td colspan=3>\n";
9 printf "<input type=radio name=mode value=0 %s> %s\n",
10         $_[0]->{'mode'} == 0 ? 'checked' : '', $text{'acl_mode0'};
11
12 printf "<input type=radio name=mode value=3 %s> %s<br>\n",
13         $_[0]->{'mode'} == 3 ? 'checked' : '', $text{'acl_mode3'};
14
15 printf "<input type=radio name=mode value=1 %s> %s\n",
16         $_[0]->{'mode'} == 1 ? 'checked' : '', $text{'acl_mode1'};
17 printf "<input name=users1 size=40 value='%s'> %s<br>\n",
18         $_[0]->{'mode'} == 1 ? $_[0]->{'users'} : '',
19         &user_chooser_button("users1", 1);
20
21 printf "<input type=radio name=mode value=2 %s> %s\n",
22         $_[0]->{'mode'} == 2 ? 'checked' : '', $text{'acl_mode2'};
23 printf "<input name=users2 size=40 value='%s'> %s<br>\n",
24         $_[0]->{'mode'} == 2 ? $_[0]->{'users'} : '',
25         &user_chooser_button("users2", 1);
26
27 printf "<input type=radio name=mode value=4 %s> %s\n",
28         $_[0]->{'mode'} == 4 ? 'checked' : '', $text{'acl_mode4'};
29 printf "<input name=low size=8 value='%s'> -\n",
30         $_[0]->{'mode'} == 4 ? $_[0]->{'low'} : '';
31 printf "<input name=high size=8 value='%s'><br>\n",
32         $_[0]->{'mode'} == 4 ? $_[0]->{'high'} : '';
33
34 printf "<input type=radio name=mode value=5 %s> %s\n",
35         $_[0]->{'mode'} == 5 ? 'checked' : '', $text{'acl_mode5'};
36 printf "<input name=groups size=20 value='%s'> %s<br>\n",
37         $_[0]->{'mode'} == 5 ? $_[0]->{'users'} : '',
38         &group_chooser_button("groups", 1);
39 printf "%s <input type=checkbox name=sec value=1 %s> %s<br>\n",
40         "&nbsp;" x 5, $_[0]->{'sec'} ? 'checked' : '',$text{'acl_sec'};
41 printf "%s %s <input name=notusers size=20 value='%s'> %s<br>\n",
42         "&nbsp;" x 5, $text{'acl_notusers'},
43         $_[0]->{'mode'} == 5 ? $_[0]->{'notusers'} : '',
44         &user_chooser_button("notusers", 1);
45
46 printf "<input type=radio name=mode value=6 %s> %s\n",
47         $_[0]->{'mode'} == 6 ? 'checked' : '', $text{'acl_mode6'};
48 printf "<input name=match size=15 value='%s'></td> </tr>\n",
49         $_[0]->{'mode'} == 6 ? $_[0]->{'users'} : '';
50
51 print "<tr> <td><b>$text{'acl_repeat'}</b></td> <td colspan=3>\n";
52 printf "<input type=radio name=repeat value=1 %s> $text{'yes'}\n",
53         $_[0]->{'repeat'} ? "checked" : "";
54 printf "<input type=radio name=repeat value=0 %s> $text{'no'}</td> </tr>\n",
55         $_[0]->{'repeat'} ? "" : "checked";
56
57 print "<tr> <td><b>$text{'acl_expire'}</b></td> <td colspan=3>\n";
58 printf "<input type=radio name=expire value=1 %s> $text{'yes'}\n",
59         $_[0]->{'expire'} ? "checked" : "";
60 printf "<input type=radio name=expire value=0 %s> $text{'no'}</td> </tr>\n",
61         $_[0]->{'expire'} ? "" : "checked";
62
63 print "<td><b>$text{'acl_others'}</b></td> <td colspan=3>\n";
64 printf "<input type=radio name=others value=1 %s> $text{'yes'}\n",
65         $_[0]->{'others'} == 1 ? "checked" : "";
66 printf "<input type=radio name=others value=2 %s> $text{'acl_opt'}\n",
67         $_[0]->{'others'} == 2 ? "checked" : "";
68 printf "<input type=radio name=others value=0 %s> $text{'no'}</td> </tr>\n",
69         $_[0]->{'others'} == 0 ? "checked" : "";
70
71 print "<tr> <td><b>$text{'acl_old'}</b></td> <td colspan=3>\n";
72 printf "<input type=radio name=old value=1 %s> $text{'yes'}\n",
73         $_[0]->{'old'} == 1 ? "checked" : "";
74 printf "<input type=radio name=old value=2 %s> $text{'acl_old_this'}\n",
75         $_[0]->{'old'} == 2 ? "checked" : "";
76 printf "<input type=radio name=old value=0 %s> $text{'no'}</td> </tr>\n",
77         $_[0]->{'old'} == 0 ? "checked" : "";
78 }
79
80 # acl_security_save(&options)
81 # Parse the form for security options for the bind8 module
82 sub acl_security_save
83 {
84 $_[0]->{'mode'} = $in{'mode'};
85 $_[0]->{'users'} = $in{'mode'} == 1 ? $in{'users1'} :
86                    $in{'mode'} == 2 ? $in{'users2'} :
87                    $in{'mode'} == 5 ? $in{'groups'} :
88                    $in{'mode'} == 6 ? $in{'match'} : undef;
89 $_[0]->{'notusers'} = $in{'mode'} == 5 ? $in{'notusers'} : undef;
90 $_[0]->{'low'} = $in{'low'};
91 $_[0]->{'high'} = $in{'high'};
92 $_[0]->{'repeat'} = $in{'repeat'};
93 $_[0]->{'old'} = $in{'old'};
94 $_[0]->{'others'} = $in{'others'};
95 $_[0]->{'expire'} = $in{'expire'};
96 $_[0]->{'sec'} = $in{'sec'};
97 }
98