Skip to content

Commit 8531d65

Browse files
author
Julien Veyssier
committed
prevent download on user<->user shares
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
1 parent 001d7d9 commit 8531d65

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

lib/TokenManager.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ public function getToken($fileId, $shareToken = null, $editoruid = null, $direct
147147
}
148148
}
149149
}
150+
151+
// disable download if at least one shared access has it disabled
152+
foreach ($files as $file) {
153+
$storage = $file->getStorage();
154+
// using string as we have no guarantee that "files_sharing" app is loaded
155+
if ($storage->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
156+
/** @var \OCA\Files_Sharing\SharedStorage $storage */
157+
$share = $storage->getShare();
158+
$canDownload = $share->getAttributes()->getAttribute('permissions', 'download');
159+
if ($canDownload !== null && !$canDownload) {
160+
$hideDownload = true;
161+
break;
162+
}
163+
}
164+
}
150165
} catch (\Exception $e) {
151166
throw $e;
152167
}

0 commit comments

Comments
 (0)