$strPrivDescReplClient = __('Allows the user to ask where the slaves / masters are.'); $strPrivDescReplSlave = __('Needed for the replication slaves.'); $strPrivDescSelect = __('Allows reading data.'); $strPrivDescShowDb = __('Gives access to the complete list of databases.'); $strPrivDescShowView = __('Allows performing SHOW CREATE VIEW queries.'); $strPrivDescShutdown = __('Allows shutting down the server.'); $strPrivDescSuper = __('Allows connecting, even if maximum number of connections is reached; ' . 'required for most administrative operations like setting global variables ' . 'or killing threads of other users.'); $strPrivDescTrigger = __('Allows creating and dropping triggers.'); $strPrivDescUpdate = __('Allows changing data.'); $strPrivDescUsage = __('No privileges.'); $_add_user_error = false; /** * Get DB information: username, hostname, dbname, * tablename, db_and_table, dbname_is_wildcard */ list($username, $hostname, $dbname, $tablename, $db_and_table, $dbname_is_wildcard) = PMA_getDataForDBInfo(); /** * Checks if the user is allowed to do what he tries to... */ if (!$GLOBALS['is_superuser'] && !$GLOBALS['is_grantuser'] && !$GLOBALS['is_createuser']) { $response->addHTML(PMA_getHtmlForSubPageHeader('privileges', '', false)); $response->addHTML(PMA_Message::error(__('No Privileges'))->getDisplay()); exit; } /** * Checks if the user is using "Change Login Information / Copy User" dialog * only to update the password */ if (isset($_REQUEST['change_copy']) && $username == $_REQUEST['old_username'] && $hostname == $_REQUEST['old_hostname']) { $response->addHTML(PMA_Message::error(__('Username and hostname didn\'t change.'))->getDisplay()); $response->isSuccess(false);
/** * Test for PMA_getDataForDBInfo * * @return void */ public function testPMAGetDataForDBInfo() { $_REQUEST['username'] = "******"; $_REQUEST['hostname'] = "PMA_hostname"; $_REQUEST['tablename'] = "PMA_tablename"; $_REQUEST['dbname'] = "PMA_dbname"; list($username, $hostname, $dbname, $tablename, $routinename, $db_and_table, $dbname_is_wildcard) = PMA_getDataForDBInfo(); $this->assertEquals("PMA_username", $username); $this->assertEquals("PMA_hostname", $hostname); $this->assertEquals("PMA_dbname", $dbname); $this->assertEquals("PMA_tablename", $tablename); $this->assertEquals("`PMA_dbname`.`PMA_tablename`", $db_and_table); $this->assertEquals(true, $dbname_is_wildcard); //pre variable have been defined $_REQUEST['pred_tablename'] = "PMA_pred__tablename"; $_REQUEST['pred_dbname'] = array("PMA_pred_dbname"); list(, , $dbname, $tablename, $routinename, $db_and_table, $dbname_is_wildcard) = PMA_getDataForDBInfo(); $this->assertEquals("PMA_pred_dbname", $dbname); $this->assertEquals("PMA_pred__tablename", $tablename); $this->assertEquals("`PMA_pred_dbname`.`PMA_pred__tablename`", $db_and_table); $this->assertEquals(true, $dbname_is_wildcard); }
. 'required for most administrative operations like setting global variables ' . 'or killing threads of other users.' ); $strPrivDescTrigger = __('Allows creating and dropping triggers.'); $strPrivDescUpdate = __('Allows changing data.'); $strPrivDescUsage = __('No privileges.'); $_add_user_error = false; /** * Get DB information: username, hostname, dbname, * tablename, db_and_table, dbname_is_wildcard */ list( $username, $hostname, $dbname, $tablename, $routinename, $db_and_table, $dbname_is_wildcard ) = PMA_getDataForDBInfo(); /** * Checks if the user is allowed to do what he tries to... */ if (!$GLOBALS['is_superuser'] && !$GLOBALS['is_grantuser'] && !$GLOBALS['is_createuser'] ) { $response->addHTML(PMA_getHtmlForSubPageHeader('privileges', '', false)); $response->addHTML( PMA\libraries\Message::error(__('No Privileges')) ->getDisplay() ); exit; }