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, '&')