Handle hostnames with upper-case letters
[webmin.git] / syslog / acl_security.pl
1
2 require 'syslog-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the syslog module
6 sub acl_security_form
7 {
8 # Can edit syslog settings
9 print &ui_table_row($text{'acl_noedit'},
10                     &ui_yesno_radio("noedit", int($_[0]->{'noedit'})));
11
12 # Can enter arbitrary filename
13 print &ui_table_row($text{'acl_any'},
14                     &ui_yesno_radio("any", int($_[0]->{'any'})));
15
16 # Can view syslog logs and logs from other modules
17 print &ui_table_row($text{'acl_syslog'},
18                     &ui_yesno_radio("syslog", int($_[0]->{'syslog'})));
19 print &ui_table_row($text{'acl_others'},
20                     &ui_yesno_radio("others", int($_[0]->{'others'})));
21
22 # Allowed directories
23 print &ui_table_row($text{'acl_logs'},
24             &ui_radio("logs_def", $_[0]->{'logs'} ? 0 : 1,
25                       [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ]).
26             "<br>\n".
27             &ui_textarea("logs", join("\n", split(/\t+/, $_[0]->{'logs'})),
28                          5, 50), 3);
29
30 # Extra per-user log files
31 print &ui_table_row($text{'acl_extra'},
32             &ui_textarea("extras", join("\n", split(/\t+/, $_[0]->{'extras'})),
33                          5, 50), 3);
34
35 }
36
37 # acl_security_save(&options)
38 # Parse the form for security options for the syslog module
39 sub acl_security_save
40 {
41 $_[0]->{'noedit'} = $in{'noedit'};
42 $_[0]->{'any'} = $in{'any'};
43 $_[0]->{'syslog'} = $in{'syslog'};
44 $_[0]->{'others'} = $in{'others'};
45 $in{'logs'} =~ s/\r//g;
46 $_[0]->{'logs'} = $in{'logs_def'} ? undef :
47                         join("\t", split(/\n/, $in{'logs'}));
48 $_[0]->{'extras'} = join("\t", split(/\n/, $in{'extras'}));
49 }
50