Skip to content

Commit 950db4c

Browse files
committed
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 35333ce commit 950db4c

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
@@ -262,18 +262,6 @@ protected function emitShareAccessEvent(IShare $share, string $step = '', int $e
262262
* @return bool
263263
*/
264264
private function validateShare(IShare $share) {
265-
// If the owner is disabled no access to the link is granted
266-
$owner = $this->userManager->get($share->getShareOwner());
267-
if ($owner === null || !$owner->isEnabled()) {
268-
return false;
269-
}
270-
271-
// If the initiator of the share is disabled no access is granted
272-
$initiator = $this->userManager->get($share->getSharedBy());
273-
if ($initiator === null || !$initiator->isEnabled()) {
274-
return false;
275-
}
276-
277265
return $share->getNode()->isReadable() && $share->getNode()->isShareable();
278266
}
279267

lib/private/Share20/Manager.php

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

tests/lib/Share20/ManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3882,7 +3882,7 @@ public function testGetShareByTokenHideDisabledUser(): void {
38823882
->method('getAppValue')
38833883
->willReturnMap([
38843884
['core', 'shareapi_allow_links', 'yes', 'yes'],
3885-
['files_sharing', 'hide_disabled_user_shares', 'no', 'yes'],
3885+
['files_sharing', 'hide_disabled_user_shares', 'yes', 'yes'],
38863886
]);
38873887

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

0 commit comments

Comments
 (0)