feat(share): provide canDownload getter on the share

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2026-03-17 17:01:58 +01:00
parent c0c81958fb
commit 67392e4108
No known key found for this signature in database
GPG key ID: 7E849AE05218500F
2 changed files with 21 additions and 0 deletions

View file

@ -7,6 +7,7 @@
*/
namespace OC\Share20;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\File;
use OCP\Files\FileInfo;
@ -622,4 +623,17 @@ class Share implements IShare {
public function getReminderSent(): bool {
return $this->reminderSent;
}
public function canDownload(): bool {
if (($this->getPermissions() & Constants::PERMISSION_READ) === 0) {
return false;
}
$attributes = $this->getAttributes();
if ($attributes?->getAttribute('permissions', 'download') === false) {
return false;
}
return true;
}
}

View file

@ -633,4 +633,11 @@ interface IShare {
* @since 31.0.0
*/
public function getReminderSent(): bool;
/**
* Check if it is allowed to download this share.
*
* @since 31.0.15
*/
public function canDownload(): bool;
}