Skip to content

Commit

Permalink
Fixed phrase sanitize regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Jan 13, 2025
1 parent 9588481 commit 2ae3a01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/lib/QueryType/UserQueryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

final class UserQueryType extends AbstractQueryType
{
private const USER_SEARCH_PHRASE_PATTERN = '/[^a-zA-Z0-9@._-]/';
private const USER_SEARCH_PHRASE_PATTERN = '/[^\p{L}0-9@._-]/u';

protected function configureOptions(OptionsResolver $resolver): void
{
Expand Down Expand Up @@ -53,9 +53,7 @@ protected function doGetQuery(array $parameters): Query
*/
protected function getQueryFilter(array $parameters): Criterion
{
$criteria = [
new Criterion\IsUserEnabled(),
];
$criteria = [new Criterion\IsUserEnabled()];

if (!empty($parameters['extra_criteria'])) {
$criteria[] = $parameters['extra_criteria'];
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/REST/GetUsersWithPermissionInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public function provideDataForTestGetUsersWithPermissionsEndpoint(): iterable
'{"access":[{"id":"__FIXED_ID__","name":"Administrator User","email":"[email protected]"},{"id":"__FIXED_ID__","name":"John Doe","email":"[email protected]"},{"id":"__FIXED_ID__","name":"Josh Bar","email":"[email protected]"}],"noAccess":[{"id":"__FIXED_ID__","name":"Anonymous User","email":"[email protected]"},{"id":"__FIXED_ID__","name":"Guest Guest","email":"[email protected]"}]}',
];

yield 'Check content-read for phrase=undef*' => [
yield 'Check content-read for phrase=ł' => [
self::MEDIA_CONTENT_ITEM_ID,
self::MODULE_CONTENT,
self::FUNCTION_READ,
[
'contentId' => 41,
'phrase' => 'undef*',
'phrase' => 'ł',
],
'{"access":[],"noAccess":[]}',
];
Expand All @@ -120,7 +120,7 @@ public function provideDataForTestGetUsersWithPermissionsEndpoint(): iterable
self::FUNCTION_EDIT,
[
'contentId' => 41,
'phrase' => 'jo*',
'phrase' => 'jo',
],
'{"access":[{"id":"__FIXED_ID__","name":"John Doe","email":"[email protected]"},{"id":"__FIXED_ID__","name":"Josh Bar","email":"[email protected]"}],"noAccess":[]}',
];
Expand All @@ -131,7 +131,7 @@ public function provideDataForTestGetUsersWithPermissionsEndpoint(): iterable
self::FUNCTION_EDIT,
[
'contentId' => 41,
'phrase' => 'bar*',
'phrase' => 'bar',
],
'{"access":[{"id":"__FIXED_ID__","name":"Josh Bar","email":"[email protected]"}],"noAccess":[]}',
];
Expand Down

0 comments on commit 2ae3a01

Please sign in to comment.