Skip to content

Commit 4d63f1f

Browse files
provokateurinbackportbot[bot]
authored andcommitted
fix(files_sharing): Allow access to shares by disabled users if hide_disabled_user_shares is enabled
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent c31d4f6 commit 4d63f1f

3 files changed

Lines changed: 2 additions & 14 deletions

File tree

apps/files_sharing/lib/Controller/ShareController.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,6 @@ protected function emitShareAccessEvent(IShare $share, string $step = '', int $e
261261
* @return bool
262262
*/
263263
private function validateShare(IShare $share) {
264-
// If the owner is disabled no access to the link is granted
265-
$owner = $this->userManager->get($share->getShareOwner());
266-
if ($owner === null || !$owner->isEnabled()) {
267-
return false;
268-
}
269-
270-
// If the initiator of the share is disabled no access is granted
271-
$initiator = $this->userManager->get($share->getSharedBy());
272-
if ($initiator === null || !$initiator->isEnabled()) {
273-
return false;
274-
}
275-
276264
return $share->getNode()->isReadable() && $share->getNode()->isShareable();
277265
}
278266

lib/private/Share20/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ private function checkShare(IShare $share, int &$added = 1): void {
14161416
$added--;
14171417
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
14181418
}
1419-
if ($this->config->getAppValue('files_sharing', 'hide_disabled_user_shares', 'no') === 'yes') {
1419+
if ($this->config->getAppValue('files_sharing', 'hide_disabled_user_shares', 'yes') === 'yes') {
14201420
$uids = array_unique([$share->getShareOwner(), $share->getSharedBy()]);
14211421
foreach ($uids as $uid) {
14221422
$user = $this->userManager->get($uid);

tests/lib/Share20/ManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3923,7 +3923,7 @@ public function testGetShareByTokenHideDisabledUser(): void {
39233923
->method('getAppValue')
39243924
->willReturnMap([
39253925
['core', 'shareapi_allow_links', 'yes', 'yes'],
3926-
['files_sharing', 'hide_disabled_user_shares', 'no', 'yes'],
3926+
['files_sharing', 'hide_disabled_user_shares', 'yes', 'yes'],
39273927
]);
39283928

39293929
$this->l->expects($this->once())

0 commit comments

Comments
 (0)