2 require 'mysql-lib.pl';
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the mysql module
8 print "<tr> <td valign=top rowspan=3><b>$text{'acl_dbs'}</b></td>\n";
9 print "<td rowspan=3 valign=top>\n";
10 printf "<input type=radio name=dbs_def value=1 %s> %s\n",
11 $_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'};
12 printf "<input type=radio name=dbs_def value=0 %s> %s<br>\n",
13 $_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
14 print "<select name=dbs size=3 multiple width=100>\n";
15 map { $dcan{$_}++ } split(/\s+/, $_[0]->{'dbs'});
16 foreach $d (&list_databases()) {
17 printf "<option %s>%s\n",
18 $dcan{$d} ? 'selected' : '', $d;
20 print "</select></td>\n";
22 print "<td><b>$text{'acl_delete'}</b></td> <td>\n";
23 printf "<input type=radio name=delete value=1 %s> %s\n",
24 $_[0]->{'delete'} ? 'checked' : '', $text{'yes'};
25 printf "<input type=radio name=delete value=0 %s> %s</td> </tr>\n",
26 $_[0]->{'delete'} ? '' : 'checked', $text{'no'};
28 print "<tr> <td><b>$text{'acl_stop'}</b></td> <td>\n";
29 printf "<input type=radio name=stop value=1 %s> %s\n",
30 $_[0]->{'stop'} ? 'checked' : '', $text{'yes'};
31 printf "<input type=radio name=stop value=0 %s> %s</td> </tr>\n",
32 $_[0]->{'stop'} ? '' : 'checked', $text{'no'};
34 print "<tr> <td><b>$text{'acl_edonly'}</b></td> <td>\n";
35 printf "<input type=radio name=edonly value=1 %s> %s\n",
36 $_[0]->{'edonly'} ? 'checked' : '', $text{'yes'};
37 printf "<input type=radio name=edonly value=0 %s> %s</td> </tr>\n",
38 $_[0]->{'edonly'} ? '' : 'checked', $text{'no'};
40 print "<tr> <td><b>$text{'acl_indexes'}</b></td>\n";
41 print "<td>",&ui_yesno_radio("indexes", $_[0]->{'indexes'}),"</td>\n";
43 print "<td><b>$text{'acl_views'}</b></td>\n";
44 print "<td>",&ui_yesno_radio("views", $_[0]->{'views'}),"</td> </tr>\n";
46 print "<tr> <td><b>$text{'acl_create'}</b></td> <td colspan=3>\n";
47 printf "<input type=radio name=create value=1 %s> %s\n",
48 $_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'};
49 printf "<input type=radio name=create value=2 %s> %s\n",
50 $_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'};
51 printf "<input name=max size=5 value='%s'>\n",
53 printf "<input type=radio name=create value=0 %s> %s</td> </tr>\n",
54 $_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'};
56 print "<tr> <td><b>$text{'acl_perms'}</b></td> <td colspan=3>\n";
57 printf "<input name=perms type=radio value=1 %s> %s\n",
58 $_[0]->{'perms'} == 1 ? 'checked' : '', $text{'yes'};
59 printf "<input name=perms type=radio value=2 %s> %s\n",
60 $_[0]->{'perms'} == 2 ? 'checked' : '', $text{'acl_only'};
61 printf "<input name=perms type=radio value=0 %s> %s\n",
62 $_[0]->{'perms'} == 0 ? 'checked' : '', $text{'no'};
63 print "</td> </tr>\n";
65 print "<tr> <td valign=top><b>$text{'acl_login'}</b></td> <td colspan=3>\n";
66 printf "<input type=radio name=user_def value=1 %s> %s<br>\n",
67 $_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'};
68 printf "<input type=radio name=user_def value=0 %s>\n",
69 $_[0]->{'user'} ? 'checked' : '';
70 printf "%s <input name=user size=10 value='%s'>\n",
71 $text{'acl_user'}, $_[0]->{'user'};
72 printf "%s <input name=pass type=password size=10 value='%s'></td> </tr>\n",
73 $text{'acl_pass'}, $_[0]->{'pass'};
75 print "<tr> <td><b>$text{'acl_buser'}</b></td>\n";
76 printf "<td colspan=3><input type=radio name=buser_def value=1 %s> %s\n",
77 $_[0]->{'buser'} ? "" : "checked", $text{'acl_bnone'};
78 printf "<input type=radio name=buser_def value=0 %s>\n",
79 $_[0]->{'buser'} ? "checked" : "";
80 printf "<input name=buser size=8 value='%s'> %s</td> </tr>\n",
81 $_[0]->{'buser'}, &user_chooser_button("buser");
83 print "<tr> <td><b>$text{'acl_bpath'}</b></td>\n";
84 printf "<td colspan=3><input name=bpath size=40 value='%s'> %s</td> </tr>\n",
85 $_[0]->{'bpath'}, &file_chooser_button("bpath", 1);
89 # acl_security_save(&options)
90 # Parse the form for security options for the mysql module
97 $_[0]->{'dbs'} = join(" ", split(/\0/, $in{'dbs'}));
99 $_[0]->{'create'} = $in{'create'};
100 $_[0]->{'indexes'} = $in{'indexes'};
101 $_[0]->{'views'} = $in{'views'};
102 $_[0]->{'max'} = $in{'max'};
103 $_[0]->{'delete'} = $in{'delete'};
104 $_[0]->{'bpath'} = $in{'bpath'};
105 $_[0]->{'buser'} = $in{'buser_def'} ? undef : $in{'buser'};
106 $_[0]->{'stop'} = $in{'stop'};
107 $_[0]->{'perms'} = $in{'perms'};
108 $_[0]->{'edonly'} = $in{'edonly'};
109 if ($in{'user_def'}) {
110 delete($_[0]->{'user'});
111 delete($_[0]->{'pass'});
114 $_[0]->{'user'} = $in{'user'};
115 $_[0]->{'pass'} = $in{'pass'};