Handle hostnames with upper-case letters
[webmin.git] / cluster-passwd / acl_security.pl
1
2 require 'cluster-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>$passwd::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' : '', $passwd::text{'acl_mode0'};
11
12 printf "<input type=radio name=mode value=3 %s> %s<br>\n",
13         $_[0]->{'mode'} == 3 ? 'checked' : '', $passwd::text{'acl_mode3'};
14
15 printf "<input type=radio name=mode value=1 %s> %s\n",
16         $_[0]->{'mode'} == 1 ? 'checked' : '', $passwd::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' : '', $passwd::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' : '', $passwd::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' : '', $passwd::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' : '',$passwd::text{'acl_sec'};
41
42 printf "<input type=radio name=mode value=6 %s> %s\n",
43         $_[0]->{'mode'} == 6 ? 'checked' : '', $passwd::text{'acl_mode6'};
44 printf "<input name=match size=15 value='%s'></td> </tr>\n",
45         $_[0]->{'mode'} == 6 ? $_[0]->{'users'} : '';
46
47 print "<tr> <td><b>$passwd::text{'acl_repeat'}</b></td> <td colspan=3>\n";
48 printf "<input type=radio name=repeat value=1 %s> $passwd::text{'yes'}\n",
49         $_[0]->{'repeat'} ? "checked" : "";
50 printf "<input type=radio name=repeat value=0 %s> $passwd::text{'no'}</td> </tr>\n",
51         $_[0]->{'repeat'} ? "" : "checked";
52
53 print "<td><b>$passwd::text{'acl_others'}</b></td> <td colspan=3>\n";
54 printf "<input type=radio name=others value=1 %s> $passwd::text{'yes'}\n",
55         $_[0]->{'others'} == 1 ? "checked" : "";
56 printf "<input type=radio name=others value=2 %s> $passwd::text{'acl_opt'}\n",
57         $_[0]->{'others'} == 2 ? "checked" : "";
58 printf "<input type=radio name=others value=0 %s> $passwd::text{'no'}</td> </tr>\n",
59         $_[0]->{'others'} == 0 ? "checked" : "";
60
61 print "<tr> <td><b>$passwd::text{'acl_old'}</b></td> <td colspan=3>\n";
62 printf "<input type=radio name=old value=1 %s> $passwd::text{'yes'}\n",
63         $_[0]->{'old'} == 1 ? "checked" : "";
64 printf "<input type=radio name=old value=2 %s> $passwd::text{'acl_old_this'}\n",
65         $_[0]->{'old'} == 2 ? "checked" : "";
66 printf "<input type=radio name=old value=0 %s> $passwd::text{'no'}</td> </tr>\n",
67         $_[0]->{'old'} == 0 ? "checked" : "";
68 }
69
70 # acl_security_save(&options)
71 # Parse the form for security options for the bind8 module
72 sub acl_security_save
73 {
74 $_[0]->{'mode'} = $in{'mode'};
75 $_[0]->{'users'} = $in{'mode'} == 1 ? $in{'users1'} :
76                    $in{'mode'} == 2 ? $in{'users2'} :
77                    $in{'mode'} == 5 ? $in{'groups'} :
78                    $in{'mode'} == 6 ? $in{'match'} : undef;
79 $_[0]->{'low'} = $in{'low'};
80 $_[0]->{'high'} = $in{'high'};
81 $_[0]->{'repeat'} = $in{'repeat'};
82 $_[0]->{'old'} = $in{'old'};
83 $_[0]->{'others'} = $in{'others'};
84 $_[0]->{'expire'} = $in{'expire'};
85 $_[0]->{'sec'} = $in{'sec'};
86 }
87