203 $pa_srvr = getenv('SERVER_NAME'); |
203 $pa_srvr = getenv('SERVER_NAME'); |
204 $dns_hostmaster = $_POST['dns_hostmaster']; |
204 $dns_hostmaster = $_POST['dns_hostmaster']; |
205 $dns_ns1 = $_POST['dns_ns1']; |
205 $dns_ns1 = $_POST['dns_ns1']; |
206 $dns_ns2 = $_POST['dns_ns2']; |
206 $dns_ns2 = $_POST['dns_ns2']; |
207 |
207 |
|
208 require_once("../inc/database.inc.php"); |
|
209 $db = dbConnect(); |
|
210 include_once("database-structure.inc.php"); |
|
211 |
208 echo "<p>" . _('You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database.') . " "; |
212 echo "<p>" . _('You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database.') . " "; |
209 if ($db_type == 'mysql') { |
213 if ($db_type == 'mysql') { |
210 echo _('In MySQL you should now perform the following command:') . "</p>"; |
214 echo _('In MySQL you should now perform the following command:') . "</p>"; |
211 echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON " . $db_name . ".*<br>TO '" . $db_user . "'@'" . $pa_srvr . "'<br>IDENTIFIED BY '" . $db_pass . "';</tt></p>"; |
215 echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON " . $db_name . ".*<br>TO '" . $db_user . "'@'" . $pa_srvr . "'<br>IDENTIFIED BY '" . $db_pass . "';</tt></p>"; |
212 } elseif ($db_type == 'pgsql') { |
216 } elseif ($db_type == 'pgsql') { |
216 "Enter it again: " . $db_pass . "<br>" . |
220 "Enter it again: " . $db_pass . "<br>" . |
217 "Shall the new role be a superuser? (y/n) n<br>" . |
221 "Shall the new role be a superuser? (y/n) n<br>" . |
218 "Shall the new user be allowed to create databases? (y/n) n<br>" . |
222 "Shall the new user be allowed to create databases? (y/n) n<br>" . |
219 "Shall the new user be allowed to create more new users? (y/n) n<br>" . |
223 "Shall the new user be allowed to create more new users? (y/n) n<br>" . |
220 "CREATE USER<br>" . |
224 "CREATE USER<br>" . |
221 "$ psql " . $db_name . "<br>" . |
225 "$ psql " . $db_name . "<br>"; |
222 "psql> GRANT SELECT, INSERT, DELETE, UPDATE<br>" . |
226 foreach ($grantTables as $tableName) { |
223 "ON " . $db_name . "<br>" . |
227 echo "psql> GRANT SELECT, INSERT, DELETE, UPDATE ON " . $tableName . " TO " . $db_user . ";<br />"; |
224 "TO " . $db_user . ";</tt></p>\n"; |
228 echo "GRANT<br />"; |
|
229 } |
|
230 echo "</tt></p>\n"; |
225 } |
231 } |
226 echo "<p>" . _('After you have added the new user, proceed with this installation procedure.') . "</p>\n"; |
232 echo "<p>" . _('After you have added the new user, proceed with this installation procedure.') . "</p>\n"; |
227 echo "<form method=\"post\">"; |
233 echo "<form method=\"post\">"; |
228 echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">"; |
234 echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">"; |
229 echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">"; |
235 echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">"; |