Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
commit
86ea50336b
@ -44,6 +44,7 @@ phpMyAdmin - ChangeLog
|
||||
- issue #18212 Fix Query Builder doesn't replace a table name with it's alias in the `WHERE` block
|
||||
- issue Keep the criteria box collapsed by the user when un-checking the criteria checkbox
|
||||
- issue Fix colspan for actions column on database table list
|
||||
- issue Fix double encoding on User Groups pages
|
||||
|
||||
5.2.1 (2023-02-07)
|
||||
- issue #17522 Fix case where the routes cache file is invalid
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.ts';
|
||||
import { escapeHtml } from '../modules/functions/escape.ts';
|
||||
|
||||
/**
|
||||
* @fileoverview Javascript functions used in server user groups page
|
||||
@ -26,7 +25,7 @@ AJAX.registerOnload('server/user_groups.js', function () {
|
||||
const userGroupName = $(event.relatedTarget).data('user-group');
|
||||
(this.querySelector('.modal-body') as HTMLDivElement).innerText = window.sprintf(
|
||||
window.Messages.strDropUserGroupWarning,
|
||||
escapeHtml(userGroupName)
|
||||
userGroupName
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class UserGroups
|
||||
|
||||
foreach ($userGroups as $groupName => $tabs) {
|
||||
$userGroupVal = [];
|
||||
$userGroupVal['name'] = htmlspecialchars((string) $groupName);
|
||||
$userGroupVal['name'] = $groupName;
|
||||
$userGroupVal['serverTab'] = self::getAllowedTabNames($tabs, 'server');
|
||||
$userGroupVal['dbTab'] = self::getAllowedTabNames($tabs, 'db');
|
||||
$userGroupVal['tableTab'] = self::getAllowedTabNames($tabs, 'table');
|
||||
|
||||
@ -862,9 +862,6 @@
|
||||
<code>$tabs</code>
|
||||
<code>$tabs</code>
|
||||
</PossiblyNullIterator>
|
||||
<RedundantCastGivenDocblockType>
|
||||
<code>(string) $groupName</code>
|
||||
</RedundantCastGivenDocblockType>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/AbstractController.php">
|
||||
<InvalidArrayOffset>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{% if user_group == null %}
|
||||
<h2>{{ 'Add user group'|trans }}</h2>
|
||||
{% else %}
|
||||
<h2>{{ 'Edit user group: \'%s\''|trans|format(edit_user_group_special_chars) }}</h2>
|
||||
<h2>{{ 'Edit user group: \'%s\''|trans|format(edit_user_group_special_chars)|raw }}</h2>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ user_group_url|raw }}" method="post" class="card disableAjax">
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<h2>{{ 'Users of \'%s\' user group'|trans|format(user_group_special_chars) }}</h2>
|
||||
<h2>{{ 'Users of \'%s\' user group'|trans|format(user_group_special_chars)|raw }}</h2>
|
||||
{% if num_rows == 0 %}
|
||||
<p>{% trans 'No users were found belonging to this user group.' %}</p>
|
||||
{% else %}
|
||||
|
||||
@ -12,11 +12,10 @@ use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
use PhpMyAdmin\Tests\Stubs\DummyResult;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
use function htmlspecialchars;
|
||||
|
||||
/** @covers \PhpMyAdmin\ConfigStorage\UserGroups */
|
||||
class UserGroupsTest extends AbstractTestCase
|
||||
{
|
||||
@ -75,16 +74,16 @@ class UserGroupsTest extends AbstractTestCase
|
||||
public function testGetHtmlForUserGroupsTableWithUserGroups(): void
|
||||
{
|
||||
$html = UserGroups::getHtmlForUserGroupsTable($this->configurableMenusFeature);
|
||||
$this->assertStringContainsString('<td>usergroup</td>', $html);
|
||||
$this->assertStringContainsString('<td>user<br>group</td>', $html);
|
||||
$urlTag = '<a class="" href="' . Url::getFromRoute('/server/user-groups') . '" data-post="'
|
||||
. Url::getCommon(['viewUsers' => 1, 'userGroup' => htmlspecialchars('usergroup')], '');
|
||||
. Url::getCommon(['viewUsers' => 1, 'userGroup' => 'user<br>group'], '');
|
||||
$this->assertStringContainsString($urlTag, $html);
|
||||
$urlTag = '<a class="" href="' . Url::getFromRoute('/server/user-groups') . '" data-post="'
|
||||
. Url::getCommon(['editUserGroup' => 1, 'userGroup' => htmlspecialchars('usergroup')], '');
|
||||
. Url::getCommon(['editUserGroup' => 1, 'userGroup' => 'user<br>group'], '');
|
||||
$this->assertStringContainsString($urlTag, $html);
|
||||
$this->assertStringContainsString(
|
||||
'<button type="button" class="btn btn-link" data-bs-toggle="modal"'
|
||||
. ' data-bs-target="#deleteUserGroupModal" data-user-group="usergroup">',
|
||||
. ' data-bs-target="#deleteUserGroupModal" data-user-group="user<br>group">',
|
||||
$html,
|
||||
);
|
||||
}
|
||||
@ -121,7 +120,7 @@ class UserGroupsTest extends AbstractTestCase
|
||||
|
||||
$resultStub = $this->createMock(DummyResult::class);
|
||||
|
||||
$expectedQuery = 'SELECT * FROM `pmadb`.`usergroups` WHERE `usergroup`=\'ug\'';
|
||||
$expectedQuery = 'SELECT * FROM `pmadb`.`usergroups` WHERE `usergroup`=\'user<br>group\'';
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -132,7 +131,7 @@ class UserGroupsTest extends AbstractTestCase
|
||||
$resultStub->expects($this->exactly(1))
|
||||
->method('getIterator')
|
||||
->will($this->returnCallback(static function (): Generator {
|
||||
yield from [['usergroup' => 'ug', 'tab' => 'server_sql', 'allowed' => 'Y']];
|
||||
yield from [['usergroup' => 'user<br>group', 'tab' => 'server_sql', 'allowed' => 'Y']];
|
||||
}));
|
||||
$dbi->expects($this->any())->method('quoteString')
|
||||
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
|
||||
@ -140,8 +139,9 @@ class UserGroupsTest extends AbstractTestCase
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
// editing a user group
|
||||
$html = UserGroups::getHtmlToEditUserGroup($this->configurableMenusFeature, 'ug');
|
||||
$this->assertStringContainsString('<input type="hidden" name="userGroup" value="ug"', $html);
|
||||
$html = UserGroups::getHtmlToEditUserGroup($this->configurableMenusFeature, 'user<br>group');
|
||||
$this->assertStringContainsString('Edit user group: \'user<br>group\'', $html);
|
||||
$this->assertStringContainsString('<input type="hidden" name="userGroup" value="user<br>group"', $html);
|
||||
$this->assertStringContainsString('<input type="hidden" name="editUserGroupSubmit" value="1"', $html);
|
||||
$this->assertStringContainsString('<input type="hidden" name="editUserGroupSubmit" value="1"', $html);
|
||||
$this->assertStringContainsString(
|
||||
@ -155,4 +155,17 @@ class UserGroupsTest extends AbstractTestCase
|
||||
$html,
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetHtmlForListingUsersOfAGroupWithNoUsers(): void
|
||||
{
|
||||
$dummyDbi = new DbiDummy();
|
||||
$dbi = DatabaseInterface::load($dummyDbi);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$dummyDbi->addResult('SELECT `username` FROM `pmadb`.`users` WHERE `usergroup`=\'user<br>group\'', []);
|
||||
|
||||
$output = UserGroups::getHtmlForListingUsersofAGroup($this->configurableMenusFeature, 'user<br>group');
|
||||
$this->assertStringContainsString('Users of \'user<br>group\' user group', $output);
|
||||
$this->assertStringContainsString('No users were found belonging to this user group.', $output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1793,7 +1793,7 @@ class DbiDummy implements DbiExtension
|
||||
[
|
||||
'query' => 'SELECT * FROM `pmadb`.`usergroups` ORDER BY `usergroup` ASC',
|
||||
'columns' => ['usergroup', 'tab', 'allowed'],
|
||||
'result' => [['usergroup', 'server_sql', 'Y']],
|
||||
'result' => [['user<br>group', 'server_sql', 'Y']],
|
||||
],
|
||||
[
|
||||
'query' => 'DESCRIBE `test_table`',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user