Skip to content

Commit 056ccc6

Browse files
committed
FInish backport to stable22 of #32322
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent fc834d4 commit 056ccc6

File tree

7 files changed

+32
-8
lines changed

7 files changed

+32
-8
lines changed

apps/settings/lib/Settings/Admin/Sharing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getForm() {
8383
'restrictUserEnumerationFullMatch' => $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes'),
8484
'restrictUserEnumerationFullMatchUserId' => $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes'),
8585
'restrictUserEnumerationFullMatchEmail' => $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes'),
86-
'restrictUserEnumerationFullMatchIgnoreSecondDisplayName' => $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name', 'no'),
86+
'restrictUserEnumerationFullMatchIgnoreSecondDN' => $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no'),
8787
'enforceLinkPassword' => Util::isPublicLinkPasswordRequired(),
8888
'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(),
8989
'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'),

apps/settings/tests/Settings/Admin/SharingTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testGetFormWithoutExcludedGroups() {
7878
['core', 'shareapi_restrict_user_enumeration_full_match', 'yes', 'yes'],
7979
['core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes', 'yes'],
8080
['core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes', 'yes'],
81-
['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name', 'no', 'no'],
81+
['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no', 'no'],
8282
['core', 'shareapi_enabled', 'yes', 'yes'],
8383
['core', 'shareapi_default_expire_date', 'no', 'no'],
8484
['core', 'shareapi_expire_after_n_days', '7', '7'],
@@ -111,7 +111,7 @@ public function testGetFormWithoutExcludedGroups() {
111111
'restrictUserEnumerationFullMatch' => 'yes',
112112
'restrictUserEnumerationFullMatchUserId' => 'yes',
113113
'restrictUserEnumerationFullMatchEmail' => 'yes',
114-
'restrictUserEnumerationFullMatchIgnoreSecondDisplayName' => 'no',
114+
'restrictUserEnumerationFullMatchIgnoreSecondDN' => 'no',
115115
'enforceLinkPassword' => false,
116116
'onlyShareWithGroupMembers' => false,
117117
'shareAPIEnabled' => 'yes',
@@ -153,7 +153,7 @@ public function testGetFormWithExcludedGroups() {
153153
['core', 'shareapi_restrict_user_enumeration_full_match', 'yes', 'yes'],
154154
['core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes', 'yes'],
155155
['core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes', 'yes'],
156-
['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name', 'no', 'no'],
156+
['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no', 'no'],
157157
['core', 'shareapi_enabled', 'yes', 'yes'],
158158
['core', 'shareapi_default_expire_date', 'no', 'no'],
159159
['core', 'shareapi_expire_after_n_days', '7', '7'],
@@ -186,7 +186,7 @@ public function testGetFormWithExcludedGroups() {
186186
'restrictUserEnumerationFullMatch' => 'yes',
187187
'restrictUserEnumerationFullMatchUserId' => 'yes',
188188
'restrictUserEnumerationFullMatchEmail' => 'yes',
189-
'restrictUserEnumerationFullMatchIgnoreSecondDisplayName' => 'no',
189+
'restrictUserEnumerationFullMatchIgnoreSecondDN' => 'no',
190190
'enforceLinkPassword' => false,
191191
'onlyShareWithGroupMembers' => false,
192192
'shareAPIEnabled' => 'yes',

build/integration/features/bootstrap/CollaborationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function resetAppConfigs(): void {
7171
$this->deleteServerConfig('core', 'shareapi_restrict_user_enumeration_full_match');
7272
$this->deleteServerConfig('core', 'shareapi_restrict_user_enumeration_full_match_userid');
7373
$this->deleteServerConfig('core', 'shareapi_restrict_user_enumeration_full_match_email');
74-
$this->deleteServerConfig('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name');
74+
$this->deleteServerConfig('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn');
7575
$this->deleteServerConfig('core', 'shareapi_only_share_with_group_members');
7676
}
7777

lib/private/Collaboration/Collaborators/UserPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct(IConfig $config,
9595
$this->shareeEnumerationFullMatch = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes') === 'yes';
9696
$this->shareeEnumerationFullMatchUserId = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes') === 'yes';
9797
$this->shareeEnumerationFullMatchEmail = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes';
98-
$this->shareeEnumerationFullMatchIgnoreSecondDisplayName = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name', 'no') === 'yes';
98+
$this->shareeEnumerationFullMatchIgnoreSecondDisplayName = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no') === 'yes';
9999
}
100100

101101
public function search($search, $limit, $offset, ISearchResult $searchResult) {

lib/private/Share20/Manager.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,14 @@ public function allowEnumerationFullMatch(): bool {
19001900
return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes') === 'yes';
19011901
}
19021902

1903+
public function matchEmail(): bool {
1904+
return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes';
1905+
}
1906+
1907+
public function ignoreSecondDisplayName(): bool {
1908+
return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no') === 'yes';
1909+
}
1910+
19031911
/**
19041912
* Copied from \OC_Util::isSharingDisabledForUser
19051913
*

lib/public/Share/IManager.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,22 @@ public function limitEnumerationToPhone(): bool;
447447
*/
448448
public function allowEnumerationFullMatch(): bool;
449449

450+
/**
451+
* Check if the search should match the email
452+
*
453+
* @return bool
454+
* @since 25.0.0
455+
*/
456+
public function matchEmail(): bool;
457+
458+
/**
459+
* Check if the search should ignore the second in parentheses display name if there is any
460+
*
461+
* @return bool
462+
* @since 25.0.0
463+
*/
464+
public function ignoreSecondDisplayName(): bool;
465+
450466
/**
451467
* Check if sharing is disabled for the given user
452468
*

tests/lib/Collaboration/Collaborators/UserPluginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ public function dataSearchEnumeration() {
657657
[
658658
'core' => [
659659
'shareapi_allow_share_dialog_user_enumeration' => 'no',
660-
'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name' => 'yes',
660+
'shareapi_restrict_user_enumeration_full_match_ignore_second_dn' => 'yes',
661661
],
662662
]
663663
],

0 commit comments

Comments
 (0)