# HG changeset patch # User peter # Date 1216066654 0 # Node ID b918c891f81d826498055a622e4b640d8b041541 # Parent 4066e4c0de01ecc5c04b371b4e2274d082b04a06 [feladat @ 298] Bugfix: The GRANT statement for PostgreSQL is not correct. Modified the code to give the correct GRANT statement based on the tables in database-structure.inc.php. Reported by grin. Closes: #78. diff -r 4066e4c0de01 -r b918c891f81d install/database-structure.inc.php --- a/install/database-structure.inc.php Mon Jul 14 16:19:30 2008 +0000 +++ b/install/database-structure.inc.php Mon Jul 14 20:17:34 2008 +0000 @@ -256,6 +256,13 @@ ) ); +// Tables from PowerDNS +$grantTables = array('supermasters', 'domains', 'records'); +// Include PowerAdmin tables +foreach($def_tables as $table) { + $grantTables[] = $table['table_name']; +} + $def_permissions = array( array(41,'zone_master_add','User is allowed to add new master zones.'), array(42,'zone_slave_add','User is allowed to add new slave zones.'), diff -r 4066e4c0de01 -r b918c891f81d install/index.php --- a/install/index.php Mon Jul 14 16:19:30 2008 +0000 +++ b/install/index.php Mon Jul 14 20:17:34 2008 +0000 @@ -205,6 +205,10 @@ $dns_ns1 = $_POST['dns_ns1']; $dns_ns2 = $_POST['dns_ns2']; + require_once("../inc/database.inc.php"); + $db = dbConnect(); + include_once("database-structure.inc.php"); + echo "

" . _('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.') . " "; if ($db_type == 'mysql') { echo _('In MySQL you should now perform the following command:') . "

"; @@ -218,10 +222,12 @@ "Shall the new user be allowed to create databases? (y/n) n
" . "Shall the new user be allowed to create more new users? (y/n) n
" . "CREATE USER
" . - "$ psql " . $db_name . "
" . - "psql> GRANT SELECT, INSERT, DELETE, UPDATE
" . - "ON " . $db_name . "
" . - "TO " . $db_user . ";

\n"; + "$ psql " . $db_name . "
"; + foreach ($grantTables as $tableName) { + echo "psql> GRANT SELECT, INSERT, DELETE, UPDATE ON " . $tableName . " TO " . $db_user . ";
"; + echo "GRANT
"; + } + echo "

\n"; } echo "

" . _('After you have added the new user, proceed with this installation procedure.') . "

\n"; echo "
";