Merge pull request #11832 from devenbansod/fix_11752

Fix #11752
This commit is contained in:
Michal Čihař 2016-01-14 08:58:51 +01:00
commit a478437e0e
8 changed files with 133 additions and 320 deletions

View File

@ -14,279 +14,71 @@ if (! defined('PHPMYADMIN')) {
*/
$GLOBALS['is_superuser'] = $GLOBALS['dbi']->isSuperuser();
/**
* Check if user has required privileges for
* performing 'FLUSH PRIVILEGES' operation
*
* @return void
*/
function PMA_checkRequiredPrivilegesForFlushing()
{
if (PMA_Util::cacheExists('flush_priv')) {
$GLOBALS['flush_priv'] = PMA_Util::cacheGet(
'flush_priv'
);
return;
}
$GLOBALS['flush_priv'] = $GLOBALS['dbi']->tryQuery(
'FLUSH PRIVILEGES'
);
// must also cacheUnset() them in
// libraries/plugins/auth/AuthenticationCookie.class.php
PMA_Util::cacheSet('flush_priv', $GLOBALS['flush_priv']);
}
/**
* Check if user has required privileges for
* performing 'Adjust privileges' operations
*
* @param string $show_grants_str string containing grants for user
* @param string $show_grants_dbname name of db extracted from grant string
* @param string $show_grants_tblname name of table extracted from grant string
*
* @return void
*/
function PMA_checkRequiredPrivilegesForAdjust()
{
if (PMA_Util::cacheExists('db_priv')) {
$GLOBALS['db_priv'] = PMA_Util::cacheGet(
'db_priv'
);
$GLOBALS['col_priv'] = PMA_Util::cacheGet(
'col_priv'
);
$GLOBALS['table_priv'] = PMA_Util::cacheGet(
'table_priv'
);
$GLOBALS['proc_priv'] = PMA_Util::cacheGet(
'proc_priv'
);
return;
}
function PMA_checkRequiredPrivilegesForAdjust(
$show_grants_str,
$show_grants_dbname,
$show_grants_tblname
) {
// '... ALL PRIVILEGES ON *.* ...' OR '... ALL PRIVILEGES ON `mysql`.* ..'
// OR
// SELECT, INSERT, UPDATE, DELETE .... ON *.* OR `mysql`.*
if ($show_grants_str == 'ALL'
|| $show_grants_str == 'ALL PRIVILEGES'
|| (mb_strpos(
$show_grants_str, "SELECT, INSERT, UPDATE, DELETE"
) !== false)
) {
if ($show_grants_dbname = '*'
&& $show_grants_tblname == '*'
) {
$GLOBALS['col_priv'] = true;
$GLOBALS['db_priv'] = true;
$GLOBALS['proc_priv'] = true;
$GLOBALS['table_priv'] = true;
$privs_available = true;
// FOR DB PRIVS
$select_privs_available = $GLOBALS['dbi']->tryQuery(
'SELECT * FROM `mysql`.`db` LIMIT 1'
);
$privs_available = $select_privs_available && $privs_available;
if ($privs_available) {
$delete_privs_available = $GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`db` WHERE `host` = "" AND '
. '`Db` = "" AND `User` = ""'
);
$privs_available = $delete_privs_available && $privs_available;
}
if ($privs_available) {
// unset the `foreign_key_checks` temporarily
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 0
');
$insert_privs_available = $GLOBALS['dbi']->tryQuery(
'INSERT INTO `mysql`.`db`(`host`, `Db`, `User`) VALUES("pma_test_host", '
. '"mysql", "pma_test_user")'
);
// set the `foreign_key_checks` back
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 1
');
// If successful test insert, delete the test row
if ($insert_privs_available) {
$GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`db` WHERE host = "pma_test_host" AND '
. 'Db = "mysql" AND User = "pma_test_user"'
);
if ($show_grants_str == 'ALL PRIVILEGES'
|| $show_grants_str == 'ALL'
) {
$GLOBALS['is_reload_priv'] = true;
}
}
$privs_available = $insert_privs_available && $privs_available;
}
if ($privs_available) {
$update_privs_available = $GLOBALS['dbi']->tryQuery(
'UPDATE `mysql`.`db` SET `host` = "" WHERE `host` = "" AND '
. '`Db` = "" AND `User` = ""'
);
$privs_available = $update_privs_available && $privs_available;
}
// save the value
$GLOBALS['db_priv'] = $privs_available;
// reset the value
$privs_available = true;
// FOR COLUMNS_PRIV
$select_privs_available = $GLOBALS['dbi']->tryQuery(
'SELECT * FROM `mysql`.`columns_priv` LIMIT 1'
);
$privs_available = $select_privs_available && $privs_available;
if ($privs_available) {
$delete_privs_available = $GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`columns_priv` WHERE `host` = "" AND '
. '`Db` = "" AND `User` = ""'
);
$privs_available = $delete_privs_available && $privs_available;
}
if ($privs_available) {
// unset the `foreign_key_checks` temporarily
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 0
');
$insert_privs_available = $GLOBALS['dbi']->tryQuery(
'INSERT INTO `mysql`.`columns_priv`(`host`, `Db`, `User`, `Table_name`,'
. ' `Column_name`) VALUES("pma_test_host", '
. '"mysql", "pma_test_user", "", "")'
);
// set the `foreign_key_checks` back
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 1
');
// If successful test insert, delete the test row
if ($insert_privs_available) {
$GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`columns_priv` WHERE host = "pma_test_host" AND '
. 'Db = "mysql" AND User = "pma_test_user" AND Table_name = ""'
. ' AND Column_name = ""'
);
// check for specific tables in `mysql` db
// Ex. '... ALL PRIVILEGES on `mysql`.`columns_priv` .. '
if ($show_grants_dbname == 'mysql') {
switch ($show_grants_tblname) {
case 'columns_priv':
$GLOBALS['col_priv'] = true;
break;
case 'db':
$GLOBALS['db_priv'] = true;
break;
case 'procs_priv':
$GLOBALS['proc_priv'] = true;
break;
case 'tables_priv':
$GLOBALS['table_priv'] = true;
break;
case '*':
$GLOBALS['col_priv'] = true;
$GLOBALS['db_priv'] = true;
$GLOBALS['proc_priv'] = true;
$GLOBALS['table_priv'] = true;
break;
default:
}
}
$privs_available = $insert_privs_available && $privs_available;
}
if ($privs_available) {
$update_privs_available = $GLOBALS['dbi']->tryQuery(
'UPDATE `mysql`.`columns_priv` SET `host` = "" WHERE `host` = "" AND '
. '`Db` = "" AND `User` = "" AND Column_name = "" AND Table_name = ""'
);
$privs_available = $update_privs_available && $privs_available;
}
// Save the value
$GLOBALS['col_priv'] = $privs_available;
// Reset the value
$privs_available = true;
// FOR TABLES_PRIV
$select_privs_available = $GLOBALS['dbi']->tryQuery(
'SELECT * FROM `mysql`.`tables_priv` LIMIT 1'
);
$privs_available = $select_privs_available && $privs_available;
if ($privs_available) {
$delete_privs_available = $GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`tables_priv` WHERE `host` = "" AND '
. '`Db` = "" AND `User` = "" AND Table_name = ""'
);
$privs_available = $delete_privs_available && $privs_available;
}
if ($privs_available) {
// unset the `foreign_key_checks` temporarily
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 0
');
$insert_privs_available = $GLOBALS['dbi']->tryQuery(
'INSERT INTO `mysql`.`tables_priv`(`host`, `Db`, `User`, `Table_name`'
. ') VALUES("pma_test_host", '
. '"mysql", "pma_test_user", "")'
);
// set the `foreign_key_checks` back
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 1
');
// If successful test insert, delete the test row
if ($insert_privs_available) {
$GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`tables_priv` WHERE host = "pma_test_host" AND '
. 'Db = "mysql" AND User = "pma_test_user" AND Table_name = ""'
);
}
$privs_available = $insert_privs_available && $privs_available;
}
if ($privs_available) {
$update_privs_available = $GLOBALS['dbi']->tryQuery(
'UPDATE `mysql`.`tables_priv` SET `host` = "" WHERE `host` = "" AND '
. '`Db` = "" AND `User` = "" AND Table_name = ""'
);
$privs_available = $update_privs_available && $privs_available;
}
// Save the value
$GLOBALS['table_priv'] = $privs_available;
// Reset the value
$privs_available = true;
// FOR PROCS_PRIV
$select_privs_available = $GLOBALS['dbi']->tryQuery(
'SELECT * FROM `mysql`.`procs_priv` LIMIT 1'
);
$privs_available = $select_privs_available && $privs_available;
if ($privs_available) {
$delete_privs_available = $GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`procs_priv` WHERE `host` = "" AND '
. '`Db` = "" AND `User` = "" AND `Routine_name` = ""'
. ' AND `Routine_type` = ""'
);
$privs_available = $delete_privs_available && $privs_available;
}
if ($privs_available) {
// unset the `foreign_key_checks` temporarily
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 0
');
$insert_privs_available = $GLOBALS['dbi']->tryQuery(
'INSERT INTO `mysql`.`procs_priv`(`host`, `Db`, `User`, `Routine_name`,'
. ' `Routine_type`) VALUES("pma_test_host", '
. '"mysql", "pma_test_user", "", "PROCEDURE")'
);
// set the `foreign_key_checks` back
$GLOBALS['dbi']->tryQuery('
SET @@session.foreign_key_checks = 1
');
// If successful test insert, delete the test row
if ($insert_privs_available) {
$GLOBALS['dbi']->tryQuery(
'DELETE FROM `mysql`.`procs_priv` WHERE `host` = "pma_test_host" AND '
. '`Db` = "mysql" AND `User` = "pma_test_user" AND `Routine_name` = ""'
. ' AND `Routine_type` = "PROCEDURE"'
);
}
$privs_available = $insert_privs_available && $privs_available;
}
if ($privs_available) {
$update_privs_available = $GLOBALS['dbi']->tryQuery(
'UPDATE `mysql`.`procs_priv` SET `host` = "" WHERE `host` = "" AND '
. '`Db` = "" AND `User` = "" AND `Routine_name` = ""'
);
$privs_available = $update_privs_available && $privs_available;
}
// Save the value
$GLOBALS['proc_priv'] = $privs_available;
// must also cacheUnset() them in
// libraries/plugins/auth/AuthenticationCookie.class.php
PMA_Util::cacheSet('proc_priv', $GLOBALS['proc_priv']);
PMA_Util::cacheSet('table_priv', $GLOBALS['table_priv']);
PMA_Util::cacheSet('col_priv', $GLOBALS['col_priv']);
PMA_Util::cacheSet('db_priv', $GLOBALS['db_priv']);
}
/**
@ -325,6 +117,20 @@ function PMA_analyseShowGrant()
$GLOBALS['dbs_to_test'] = PMA_Util::cacheGet(
'dbs_to_test'
);
$GLOBALS['db_priv'] = PMA_Util::cacheGet(
'db_priv'
);
$GLOBALS['col_priv'] = PMA_Util::cacheGet(
'col_priv'
);
$GLOBALS['table_priv'] = PMA_Util::cacheGet(
'table_priv'
);
$GLOBALS['proc_priv'] = PMA_Util::cacheGet(
'proc_priv'
);
return;
}
@ -334,6 +140,10 @@ function PMA_analyseShowGrant()
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array();
$GLOBALS['dbs_to_test'] = $GLOBALS['dbi']->getSystemSchemas();
$GLOBALS['proc_priv'] = false;
$GLOBALS['db_priv'] = false;
$GLOBALS['col_priv'] = false;
$GLOBALS['table_priv'] = false;
$rs_usr = $GLOBALS['dbi']->tryQuery('SHOW GRANTS');
@ -359,6 +169,16 @@ function PMA_analyseShowGrant()
(/*overload*/mb_strpos($row[0], ' ON ') - 6)
);
// extrac table from GRANT sytax
$tblname_start_offset = /*overload*/mb_strpos($row[0], '.') + 1;
$tblname_end_offset = /*overload*/mb_strpos($row[0], ' TO ');
$show_grants_tblname = /*overload*/mb_substr(
$row[0], $tblname_start_offset,
$tblname_end_offset - $tblname_start_offset
);
$show_grants_tblname = PMA_Util::unQuote($show_grants_tblname, '`');
if ($show_grants_dbname == '*') {
if ($show_grants_str != 'USAGE') {
$GLOBALS['dbs_to_test'] = false;
@ -367,10 +187,20 @@ function PMA_analyseShowGrant()
$GLOBALS['dbs_to_test'][] = $show_grants_dbname;
}
if ($show_grants_str == 'RELOAD') {
if (
/*overload*/mb_strpos($show_grants_str,'RELOAD') !== false
) {
$GLOBALS['is_reload_priv'] = true;
}
// check for the required privileges for adjust
PMA_checkRequiredPrivilegesForAdjust(
$show_grants_str,
$show_grants_dbname,
$show_grants_tblname
);
/**
* @todo if we find CREATE VIEW but not CREATE, do not offer
* the create database dialog box
@ -433,6 +263,7 @@ function PMA_analyseShowGrant()
} // end if
} // end elseif
} // end if
} // end while
$GLOBALS['dbi']->freeResult($rs_usr);
@ -447,6 +278,12 @@ function PMA_analyseShowGrant()
$GLOBALS['dbs_where_create_table_allowed']
);
PMA_Util::cacheSet('dbs_to_test', $GLOBALS['dbs_to_test']);
PMA_Util::cacheSet('proc_priv', $GLOBALS['proc_priv']);
PMA_Util::cacheSet('table_priv', $GLOBALS['table_priv']);
PMA_Util::cacheSet('col_priv', $GLOBALS['col_priv']);
PMA_Util::cacheSet('db_priv', $GLOBALS['db_priv']);
} // end function
if (!PMA_DRIZZLE) {
@ -464,14 +301,7 @@ if (!PMA_DRIZZLE) {
$GLOBALS['proc_priv'] = true;
} else {
PMA_analyseShowGrant();
// Check if privileges to 'mysql'.col_privs, 'mysql'.db,
// 'mysql'.table_privs, 'mysql'.proc_privs and privileges for
// flushing the privileges are available
PMA_checkRequiredPrivilegesForFlushing();
PMA_checkRequiredPrivilegesForAdjust();
}
} else {
// todo: for simple_user_policy only database with user's login can be created
// (unless logged in as root)

View File

@ -853,7 +853,7 @@ class TableStructureController extends TableController
if ((!defined('PMA_DRIZZLE') || !PMA_DRIZZLE)
&& Util\get($GLOBALS, 'col_priv', false)
&& Util\get($GLOBALS, 'flush_priv', false)
&& Util\get($GLOBALS, 'is_reload_priv', false)
) {
$this->dbi->selectDb('mysql');

View File

@ -81,11 +81,9 @@ function PMA_getHtmlForRenameDatabase($db)
. 'value="' . htmlspecialchars($db) . '"/>';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['db_priv'] && $GLOBALS['table_priv']
&& $GLOBALS['col_priv'] && $GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
@ -229,11 +227,9 @@ function PMA_getHtmlForCopyDatabase($db)
$html_output .= '<br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['db_priv'] && $GLOBALS['table_priv']
&& $GLOBALS['col_priv'] && $GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges" checked="checked" />';
@ -587,11 +583,9 @@ function PMA_handleTheViews($views, $move, $db)
function PMA_AdjustPrivileges_moveDB($oldDb, $newname)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['db_priv'] && $GLOBALS['table_priv']
&& $GLOBALS['col_priv'] && $GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
@ -637,11 +631,9 @@ function PMA_AdjustPrivileges_moveDB($oldDb, $newname)
function PMA_AdjustPrivileges_copyDB($oldDb, $newname)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['db_priv'] && $GLOBALS['table_priv']
&& $GLOBALS['col_priv'] && $GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
@ -860,9 +852,8 @@ function PMA_getHtmlForMoveTable()
. '</label><br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['table_priv'] && $GLOBALS['col_priv']
&& $GLOBALS['is_reload_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_tables_move" '
@ -954,9 +945,8 @@ function PMA_getHtmlForRenameTable()
. '<tr><td></td><td>';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['table_priv'] && $GLOBALS['col_priv']
&& $GLOBALS['is_reload_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_table_options" '
@ -1309,9 +1299,8 @@ function PMA_getHtmlForCopytable()
$html_output .= '<br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['table_priv'] && $GLOBALS['col_priv']
&& $GLOBALS['is_reload_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
@ -1962,9 +1951,8 @@ function PMA_getQueryAndResultForPartition()
function PMA_AdjustPrivileges_renameOrMoveTable($oldDb, $oldTable, $newDb, $newTable)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['table_priv'] && $GLOBALS['col_priv']
&& $GLOBALS['is_reload_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
@ -2002,9 +1990,8 @@ function PMA_AdjustPrivileges_renameOrMoveTable($oldDb, $oldTable, $newDb, $newT
function PMA_AdjustPrivileges_copyTable($oldDb, $oldTable, $newDb, $newTable)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['table_priv'] && $GLOBALS['col_priv']
&& $GLOBALS['is_reload_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');

View File

@ -448,7 +448,6 @@ class AuthenticationCookie extends AuthenticationPlugin
PMA_Util::cacheUnset('col_priv');
PMA_Util::cacheUnset('table_priv');
PMA_Util::cacheUnset('proc_priv');
PMA_Util::cacheUnset('flush_priv');
$GLOBALS['no_activity'] = true;
$this->authFails();

View File

@ -316,16 +316,15 @@ function PMA_RTN_backupPrivileges()
return array();
}
if (!(isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv'])
&& $GLOBALS['flush_priv'])
if (! $GLOBALS['proc_priv']
|| ! $GLOBALS['is_reload_priv']
) {
return array();
}
// Backup the Old Privileges before dropping
// if $_REQUEST['item_adjust_privileges'] set
if (!isset($_REQUEST['item_adjust_privileges'])
if (! isset($_REQUEST['item_adjust_privileges'])
|| empty($_REQUEST['item_adjust_privileges'])
) {
return array();
@ -391,9 +390,8 @@ function PMA_RTN_createRoutine(
$resultAdjust = false;
if (!defined('PMA_DRIZZLE') || !PMA_DRIZZLE) {
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv'])
&& $GLOBALS['flush_priv']
if ($GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
// Insert all the previous privileges
// but with the new name and the new type
@ -999,8 +997,8 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
$retval .= PMA_Util::showDocu('faq', 'faq6-39');
$retval .= "</td>";
if (! defined('PMA_DRIZZLE') || ! PMA_DRIZZLE) {
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
if ($GLOBALS['proc_priv']
&& $GLOBALS['is_reload_priv']
) {
$retval .= " <td><input type='checkbox' "
. "name='item_adjust_privileges' value='1' checked /></td>";

View File

@ -4675,7 +4675,7 @@ function PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
if (! $GLOBALS['is_ajax_request']
|| ! empty($_REQUEST['ajax_page_request'])
) {
if (isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']) {
if ($GLOBALS['is_reload_priv']) {
$flushnote = new PMA_Message(
__(
'Note: phpMyAdmin gets the users\' privileges directly '

View File

@ -87,8 +87,7 @@ $ci_offset = -1;
<?php if (isset($_REQUEST['change_column']) && !empty($_REQUEST['change_column']) && ! PMA_DRIZZLE): ?>
<!-- column Adjust privileges, Only for 'Edit' Column(s) -->
<td class="center">
<?php $privs_available = isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']; ?>
<?php $privs_available = $GLOBALS['col_priv'] && $GLOBALS['is_reload_priv']; ?>
<?php echo PMA\Template::get('columns_definitions/column_adjust_privileges')
->render(array(
'columnNumber' => $columnNumber,

View File

@ -227,7 +227,7 @@ class TableStructureController_Test extends PHPUnit_Framework_TestCase
'col1' => 'col2'
);
$GLOBALS['col_priv'] = true;
$GLOBALS['flush_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$this->assertEquals(
true,
$method->invokeArgs($ctrl, array($adjust_privileges))