Skip to content

Commit

Permalink
rfe #1207 Export users associated with a specific schema/database
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Feb 24, 2015
1 parent 479b1bc commit ea0c0ba
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -58,6 +58,7 @@ phpMyAdmin - ChangeLog
+ rfe #1595 make professional code editor suggestion
+ rfe #1606 processlist filter
+ rfe Change tracking activation status from db level tracking page
+ rfe #1207 Export users associated with a specific schema/database

4.3.11.0 (not yet released)
- bug #4774 SQL links are completely wrong
Expand Down
43 changes: 37 additions & 6 deletions libraries/server_privileges.lib.php
Expand Up @@ -1867,8 +1867,9 @@ function PMA_getHtmlForSpecificDbPrivileges($db)
$html_output = '';
if ($GLOBALS['is_superuser']) {
// check the privileges for a particular database.
$html_output = '<form id="usersForm" action="server_privileges.php">'
. '<fieldset>' . "\n";
$html_output = '<form id="usersForm" action="server_privileges.php">';
$html_output .= PMA_URL_getHiddenInputs($db);
$html_output .= '<fieldset>';
$html_output .= '<legend>' . "\n"
. PMA_Util::getIcon('b_usrcheck.png')
. ' '
Expand All @@ -1886,9 +1887,19 @@ function PMA_getHtmlForSpecificDbPrivileges($db)
$html_output .= PMA_getHtmlForPrivsTableHead();
$privMap = PMA_getPrivMap($db);
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
$html_output .= '</table>'
. '</fieldset>'
. '</form>' . "\n";
$html_output .= '</table>';

$html_output .= '<div style="float:left;">';
$html_output .= PMA_Util::getWithSelected(
$GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], "usersForm"
);
$html_output .= PMA_Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_export',
__('Export'), 'b_tblexport.png', 'export'
);

$html_output .= '</fieldset>';
$html_output .= '</form>';
} else {
$html_output .= PMA_getHtmlForViewUsersError();
}
Expand Down Expand Up @@ -1922,6 +1933,7 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
if ($GLOBALS['is_superuser']) {
// check the privileges for a particular table.
$html_output = '<form id="usersForm" action="server_privileges.php">';
$html_output .= PMA_URL_getHiddenInputs($db, $table);
$html_output .= '<fieldset>';
$html_output .= '<legend>'
. PMA_Util::getIcon('b_usrcheck.png')
Expand Down Expand Up @@ -1953,6 +1965,16 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
PMA_mergePrivMapFromResult($privMap, $res);
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
$html_output .= '</table>';

$html_output .= '<div style="float:left;">';
$html_output .= PMA_Util::getWithSelected(
$GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], "usersForm"
);
$html_output .= PMA_Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_export',
__('Export'), 'b_tblexport.png', 'export'
);

$html_output .= '</fieldset>';
$html_output .= '</form>';
} else {
Expand Down Expand Up @@ -2025,7 +2047,9 @@ function PMA_mergePrivMapFromResult(&$privMap, $result)
function PMA_getHtmlForPrivsTableHead()
{
return '<thead>'
. '<tr><th>' . __('User') . '</th>'
. '<tr>'
. '<th></th>'
. '<th>' . __('User') . '</th>'
. '<th>' . __('Host') . '</th>'
. '<th>' . __('Type') . '</th>'
. '<th>' . __('Privileges') . '</th>'
Expand Down Expand Up @@ -2059,6 +2083,7 @@ function PMA_getHtmlForViewUsersError()
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db)
{
$html_output = '<tbody>';
$index_checkbox = 0;
$odd_row = true;
if (empty($privMap)) {
$html_output .= '<tr class="odd">'
Expand All @@ -2076,6 +2101,12 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db)
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even') . '">';

$value = htmlspecialchars($current_user . '&amp;#27;' . $current_host);
$html_output .= '<td>'
. '<input type="checkbox" class="checkall" name="selected_usr[]" '
. 'id="checkbox_sel_users_' . ($index_checkbox++) . '" '
. 'value="' . $value . '" /></td>' . "\n";

// user
$html_output .= '<td';
if ($nbPrivileges > 1) {
Expand Down

0 comments on commit ea0c0ba

Please sign in to comment.