From afc8aab04f7c09ea44b04806b426522e5ca830ee Mon Sep 17 00:00:00 2001 From: Achilles-96 Date: Tue, 22 Dec 2015 11:29:24 +0530 Subject: [PATCH 1/2] Fixes #11743 Signed-off-by: Raghuram Vadapalli --- libraries/server_privileges.lib.php | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index e26589cc7a..0a1ef4f7e0 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2404,6 +2404,71 @@ function PMA_getListOfPrivilegesAndComparedPrivileges() return array($list_of_privileges, $listOfComparedPrivs); } +/** + * Get the HTML for routine based privileges + * + * @param string $db database name + * @param string $odd_row row styling + * @param string $index_checkbox starting index for rows to be added + * + * @return string $html_output + */ +function PMA_getHtmlTableBodyForSpecificDbRoutinePrivs($db, $odd_row, $index_checkbox) +{ + $sql_query = 'SELECT * FROM `mysql`.`procs_priv` WHERE Db = "' . $db . '";'; + $response = PMA\libraries\Response::getInstance(); + $res = $GLOBALS['dbi']->query($sql_query); + $html_output = ''; + while ($row = $GLOBALS['dbi']->fetchAssoc($res)) { + + $html_output .= ''; + + $html_output .= ''; + + $html_output .= '' . $row['User'] + . '' + . '' . $row['Host'] + . '' + . '' . 'routine' + . '' + . '' . '' . $row['Routine_name'] . '' + . '' + . '' . 'Yes' + . ''; + $current_user = $row['User']; + $current_host = $row['Host']; + $routine = $row['Routine_name']; + $html_output .= ''; + if ($GLOBALS['is_grantuser']) { + $specific_db = (isset($row['Db']) && $row['Db'] != '*') + ? $row['Db'] : ''; + $specific_table = (isset($row['Table_name']) + && $row['Table_name'] != '*') + ? $row['Table_name'] : ''; + $html_output .= PMA_getUserLink( + 'edit', + $current_user, + $current_host, + $specific_db, + $specific_table, + $routine + ); + } + $html_output .= ''; + + $html_output .= ''; + $odd_row = !$odd_row; + + } + return $html_output; +} + /** * Get the HTML for user form and check the privileges for a particular database. * @@ -2695,6 +2760,9 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db) $odd_row = ! $odd_row; } } + + //For fetching routine based privileges + $html_output .= PMA_getHtmlTableBodyForSpecificDbRoutinePrivs($db, $odd_row, $index_checkbox); $html_output .= ''; return $html_output; @@ -4455,6 +4523,9 @@ function PMA_getListForExportUserDefinition($username, $hostname) // export privileges for selected users $title = __('Privileges'); + //For removing duplicate entries of users + $_REQUEST['selected_usr'] = array_unique($_REQUEST['selected_usr']); + foreach ($_REQUEST['selected_usr'] as $export_user) { $export_username = /*overload*/mb_substr( $export_user, 0, /*overload*/mb_strpos($export_user, '&') From ad33aac26f34a605744de01378e992dbd1fbb9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 22 Dec 2015 09:06:07 +0100 Subject: [PATCH 2/2] Changelog entry for #11743 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index df051a605a..194ecea3f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ phpMyAdmin - ChangeLog - issue #11728 CSV import skip row count after - issue Fixed displaying of SQL query on table operations - issue #6321 Display binary strings as text if they are valid UTF-8 ++ issue #11743 Display routine specific privileges 4.5.4.0 (not yet released) - issue #11724 live data edit of big sets is not working