5 # acl_security_form(&options)
6 # Output HTML for editing security options for the file module
9 print "<tr> <td><b>$text{'acl_user'}</b></td>\n";
10 local $u = $_[0]->{'uid'} < 0 ? '' : getpwuid($_[0]->{'uid'});
11 printf "<td colspan=3><input type=radio name=uid_def value=1 %s> %s\n",
12 $_[0]->{'uid'} < 0 ? 'checked' : '', $text{'acl_user_def'};
13 printf "<input type=radio name=uid_def value=0 %s>\n",
14 $_[0]->{'uid'} < 0 ? '' : 'checked';
15 print "<input name=uid size=8 value='$u'> ",
16 &user_chooser_button("uid", 0),"</td> </tr>\n";
18 print "<tr> <td><b>$text{'acl_umask'}</b></td>\n";
19 print "<td colspan=3><input name=umask size=3 value='$_[0]->{'umask'}'></td> </tr>\n";
21 print "<tr> <td><b>$text{'acl_follow'}</b></td> <td colspan=3>\n";
22 printf "<input type=radio name=follow value=1 %s> $text{'yes'}\n",
23 $_[0]->{'follow'} == 1 ? "checked" : "";
24 printf "<input type=radio name=follow value=2 %s> $text{'acl_fyes'}\n",
25 $_[0]->{'follow'} == 2 ? "checked" : "";
26 printf "<input type=radio name=follow value=0 %s> $text{'no'}</td> </tr>\n",
27 $_[0]->{'follow'} == 0 ? "checked" : "";
29 print "<tr> <td><b>$text{'acl_ro'}</b></td> <td colspan=3>\n";
30 printf "<input type=radio name=ro value=1 %s> $text{'yes'}\n",
31 $_[0]->{'ro'} ? "checked" : "";
32 printf "<input type=radio name=ro value=0 %s> $text{'no'}</td> </tr>\n",
33 $_[0]->{'ro'} ? "" : "checked";
35 print "<tr> <td><b>$text{'acl_max'}</b></td>\n";
36 printf "<td colspan=3><input type=radio name=max_def value=1 %s> %s\n",
37 $_[0]->{'max'} ? "" : "checked", $text{'acl_unlim'};
38 printf "<input type=radio name=max_def value=0 %s>\n",
39 $_[0]->{'max'} ? "checked" : "";
40 printf "<input name=max size=8 value='%s'> %s</td> </tr>\n",
41 $_[0]->{'max'}, $text{'acl_b'};
43 print "<tr> <td><b>$text{'acl_archive'}</b></td> <td colspan=3>\n";
44 printf "<input type=radio name=archive value=1 %s> $text{'yes'}\n",
45 $_[0]->{'archive'} == 1 ? "checked" : "";
46 printf "<input type=radio name=archive value=2 %s> $text{'acl_archmax'}\n",
47 $_[0]->{'archive'} == 2 ? "checked" : "";
48 printf "<input name=archmax size=10 value='%s'> %s\n",
49 $_[0]->{'archmax'}, $text{'acl_b'};
50 printf "<input type=radio name=archive value=0 %s> $text{'no'}</td> </tr>\n",
51 $_[0]->{'archive'} == 0 ? "checked" : "";
53 print "<tr> <td><b>$text{'acl_unarchive'}</b></td> <td colspan=3>\n";
54 printf "<input type=radio name=unarchive value=2 %s> %s\n",
55 $_[0]->{'unarchive'} == 2 ? "checked" : "", $text{'acl_unarchive2'};
56 printf "<input type=radio name=unarchive value=1 %s> %s\n",
57 $_[0]->{'unarchive'} == 1 ? "checked" : "", $text{'acl_unarchive1'};
58 printf "<input type=radio name=unarchive value=0 %s> %s</td> </tr>\n",
59 $_[0]->{'unarchive'} == 0 ? "checked" : "", $text{'acl_unarchive0'};
61 print "<tr> <td><b>$text{'acl_dostounix'}</b></td> <td colspan=3>\n";
62 printf "<input type=radio name=dostounix value=1 %s> %s\n",
63 $_[0]->{'dostounix'} == 1 ? "checked" : "", $text{'yes'};
64 printf "<input type=radio name=dostounix value=0 %s> %s</td> </tr>\n",
65 $_[0]->{'dostounix'} == 0 ? "checked" : "", $text{'no'};
67 print "<tr> <td valign=top><b>$text{'acl_buttons'}</b></td> <td colspan=3>\n";
68 foreach $b (@file_buttons) {
69 printf "<input type=checkbox name=button_%s %s> %s<br>\n",
70 $b, $_[0]->{'button_'.$b} ? "checked" : "",
71 $text{'acl_button_'.$b};
73 print "</td> </tr>\n";
75 print "<tr> <td><b>$text{'acl_noperms'}</b></td>\n";
76 print "<td>",&ui_radio("noperms", int($_[0]->{'noperms'}),
77 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td>\n";
79 print "<td><b>$text{'acl_nousers'}</b></td>\n";
80 print "<td>",&ui_radio("nousers", int($_[0]->{'nousers'}),
81 [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td> </tr>\n";
83 print "<tr> <td><b>$text{'acl_filesystems'}</b></td>\n";
84 print "<td>",&ui_yesno_radio("filesystems",
85 int($_[0]->{'filesystems'})),"</td>\n";
87 print "<td><b>$text{'acl_contents'}</b></td>\n";
88 print "<td>",&ui_yesno_radio("contents",
89 int($_[0]->{'contents'})),"</td> </tr>\n";
91 print "<tr> <td><b>$text{'acl_chroot'}</b></td>\n";
92 printf "<td colspan=3><input name=chroot size=40 value='%s'></td>\n",
95 print "<tr> <td valign=top><b>$text{'acl_dirs'}</b><br>$text{'acl_relto'}</td>\n";
96 print "<td colspan=3><textarea name=root rows=3 cols=40>",
97 join("\n", split(/\s+/, $_[0]->{'root'})),"</textarea><br>\n";
98 printf "<input type=checkbox name=home value=1 %s> %s<br>\n",
99 $_[0]->{'home'} ? 'checked' : '', $text{'acl_home'};
100 printf "<input type=checkbox name=goto value=1 %s> %s</td>\n",
101 $_[0]->{'goto'} ? 'checked' : '', $text{'acl_goto'};
103 print "<tr> <td valign=top><b>$text{'acl_nodirs'}</b><br>$text{'acl_relto'}</td>\n";
104 print "<td colspan=3><textarea name=noroot rows=3 cols=40>",
105 join("\n", split(/\s+/, $_[0]->{'noroot'})),"</textarea><br>\n";
108 # acl_security_save(&options)
109 # Parse the form for security options for the file module
110 sub acl_security_save
112 $_[0]->{'uid'} = $in{'uid_def'} ? -1 : getpwnam($in{'uid'});
113 $in{'root'} =~ s/\r//g;
114 local @root = split(/\s+/, $in{'root'});
115 map { s/\/+/\//g } @root;
116 map { s/([^\/])\/+$/$1/ } @root;
117 $_[0]->{'root'} = join(" ", @root);
118 $in{'noroot'} =~ s/\r//g;
119 local @noroot = split(/\s+/, $in{'noroot'});
120 map { s/\/+/\//g } @noroot;
121 map { s/([^\/])\/+$/$1/ } @noroot;
122 $_[0]->{'noroot'} = join(" ", @noroot);
123 $_[0]->{'follow'} = $in{'follow'};
124 $_[0]->{'ro'} = $in{'ro'};
125 $in{'umask'} =~ /^[0-7]{3}$/ || &error("Invalid umask");
126 $_[0]->{'umask'} = $in{'umask'};
127 $_[0]->{'home'} = $in{'home'};
128 $_[0]->{'goto'} = $in{'goto'};
129 $_[0]->{'max'} = $in{'max_def'} ? undef : $in{'max'};
130 $_[0]->{'archive'} = $in{'archive'};
131 $_[0]->{'archmax'} = $in{'archmax'};
132 foreach $b (@file_buttons) {
133 $_[0]->{"button_$b"} = $in{"button_$b"};
135 $_[0]->{'unarchive'} = $in{'unarchive'};
136 $_[0]->{'dostounix'} = $in{'dostounix'};
137 $_[0]->{'chroot'} = $in{'chroot'};
138 $_[0]->{'noperms'} = $in{'noperms'};
139 $_[0]->{'nousers'} = $in{'nousers'};
140 $_[0]->{'filesystems'} = $in{'filesystems'};
141 $_[0]->{'contents'} = $in{'contents'};