From 177b1101053e9520dc19fd0a31db7bff56995066 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Tue, 24 Feb 2015 16:08:14 +0530 Subject: [PATCH 1/2] Bug #1327 Hide 'Add user' link if user does not have privileges Signed-off-by: Madhura Jayaratne --- libraries/server_privileges.lib.php | 78 ++++++++++++++++------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index d3c8c53399..945dba9f3d 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2229,18 +2229,20 @@ function PMA_getHtmlListOfPrivs( // action $html_output .= ''; - $specific_db = (isset($current['Db']) && $current['Db'] != '*') - ? $current['Db'] : ''; - $specific_table = (isset($current['Table_name']) - && $current['Table_name'] != '*') - ? $current['Table_name'] : ''; - $html_output .= PMA_getUserLink( - 'edit', - $current_user, - $current_host, - $specific_db, - $specific_table - ); + if ($GLOBALS['is_grantuser']) { + $specific_db = (isset($current['Db']) && $current['Db'] != '*') + ? $current['Db'] : ''; + $specific_table = (isset($current['Table_name']) + && $current['Table_name'] != '*') + ? $current['Table_name'] : ''; + $html_output .= PMA_getUserLink( + 'edit', + $current_user, + $current_host, + $specific_db, + $specific_table + ); + } $html_output .= ''; $html_output .= ''; @@ -2423,18 +2425,18 @@ function PMA_getExtraDataForAjaxBehavior( } $new_user_string .= ''; - if ((isset($_POST['Grant_priv']) && $_POST['Grant_priv'] == 'Y')) { $new_user_string .= __('Yes'); } else { $new_user_string .= __('No'); } - $new_user_string .=''; - $new_user_string .= '' - . PMA_getUserLink('edit', $username, $hostname) - . '' . "\n"; + if ($GLOBALS['is_grantuser']) { + $new_user_string .= '' + . PMA_getUserLink('edit', $username, $hostname) + . '' . "\n"; + } if (isset($cfgRelation['menuswork']) && $user_group_count > 0) { $new_user_string .= '' @@ -2760,17 +2762,21 @@ function PMA_getHtmlForUserRights($db_rights, $dbname, } else { $html_output .= __('No'); } - $html_output .= '' . "\n" - . ''; - $html_output .= PMA_getUserLink( - 'edit', - $username, - $hostname, - (!$dbNameLength) ? $row['Db'] : $dbname, - (!$dbNameLength) ? '' : $row['Table_name'] - ); - $html_output .= '' . "\n" - . ' '; + $html_output .= ''; + + $html_output .= ''; + if ($GLOBALS['is_grantuser']) { + $html_output .= PMA_getUserLink( + 'edit', + $username, + $hostname, + (!$dbNameLength) ? $row['Db'] : $dbname, + (!$dbNameLength) ? '' : $row['Table_name'] + ); + } + $html_output .= ''; + + $html_output .= ''; if (! empty($row['can_delete']) || isset($row['Table_name']) && /*overload*/mb_strlen($row['Table_name']) @@ -3119,13 +3125,15 @@ function PMA_getHtmlTableBodyForUserRights($db_rights) . ($host['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . '' . "\n"; - $html_output .= '' - . PMA_getUserLink( - 'edit', - $host['User'], - $host['Host'] - ) - . ''; + if ($GLOBALS['is_grantuser']) { + $html_output .= '' + . PMA_getUserLink( + 'edit', + $host['User'], + $host['Host'] + ) + . ''; + } if ($cfgRelation['menuswork'] && $user_group_count > 0) { if (empty($host['User'])) { $html_output .= ''; From c127f9803bbc1ad6c5a2f670af31396f7bdbc38f Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 27 Feb 2015 08:38:16 +0530 Subject: [PATCH 2/2] ChangeLog entry for rfe #1327 Signed-off-by: Madhura Jayaratne --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 771725949a..3f91aa046d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,7 @@ phpMyAdmin - ChangeLog + rfe #1575 "Disable database expansion" : unclear directive name and explanation + rfe #1607 Tool tip for lock icon when making changes to a page ++ rfe #1327 Hide 'Add user' link if user does not have privileges 4.3.11.0 (not yet released) - bug #4774 SQL links are completely wrong