mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
feat(share): provide canDownload getter on the share
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
c0c81958fb
commit
67392e4108
2 changed files with 21 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue