2 require 'custom-lib.pl';
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the custom module
8 local $mode = $_[0]->{'cmds'} eq '*' ? 1 :
9 $_[0]->{'cmds'} =~ /^\!/ ? 2 : 0;
10 print "<tr> <td valign=top><b>$text{'acl_cmds'}</b></td> <td>\n";
11 printf "<input type=radio name=cmds_def value=1 %s> %s\n",
12 $mode == 1 ? 'checked' : '', $text{'acl_call'};
13 printf "<input type=radio name=cmds_def value=0 %s> %s\n",
14 $mode == 0 ? 'checked' : '', $text{'acl_csel'};
15 printf "<input type=radio name=cmds_def value=2 %s> %s<br>\n",
16 $mode == 2 ? 'checked' : '', $text{'acl_cexcept'};
17 print "<select name=cmds size=10 multiple width=200>\n";
18 local @cmds = &sort_commands(&list_commands());
20 map { $ccan{$_}++ } split(/\s+/, $_[0]->{'cmds'});
22 printf "<option value=%s %s> %s\n",
24 $ccan{$c->{'id'}} ? "selected" : "",
27 print "</select></td> </tr>\n";
29 print "<tr> <td><b>$text{'acl_edit'}</b></td> <td>\n";
30 printf "<input type=radio name=edit value=1 %s> $text{'yes'}\n",
31 $_[0]->{'edit'} ? "checked" : "";
32 printf "<input type=radio name=edit value=0 %s> $text{'no'}</td> </tr>\n",
33 $_[0]->{'edit'} ? "" : "checked";
36 # acl_security_save(&options)
37 # Parse the form for security options for the custom module
40 if ($in{'cmds_def'} == 1) {
41 $_[0]->{'cmds'} = "*";
43 elsif ($in{'cmds_def'} == 0) {
44 $_[0]->{'cmds'} = join(" ", split(/\0/, $in{'cmds'}));
47 $_[0]->{'cmds'} = join(" ", "!", split(/\0/, $in{'cmds'}));
49 $_[0]->{'edit'} = $in{'edit'};