()
| 83 | // ── IFile ─────────────────────────────────────────── |
| 84 | |
| 85 | public function get() |
| 86 | { |
| 87 | [$folderKey, $fileName] = $this->split(); |
| 88 | if (FolderCrypto::isEncryptedOrAncestor($folderKey)) { |
| 89 | throw new Forbidden('WebDAV is disabled inside encrypted folders'); |
| 90 | } |
| 91 | $canFull = $this->isAdmin || ACL::canRead($this->user, $this->perms, $folderKey); |
| 92 | if (!$canFull) { |
| 93 | // own-only? |
| 94 | if (!ACL::hasGrant($this->user, $folderKey, 'read_own') || !$this->isOwner($folderKey, $fileName)) { |
| 95 | throw new Forbidden('No view access to this file'); |
| 96 | } |
| 97 | } |
| 98 | \AuditHook::log('file.download', [ |
| 99 | 'user' => $this->user, |
| 100 | 'source' => 'webdav', |
| 101 | 'folder' => $folderKey, |
| 102 | 'path' => ($folderKey === 'root') ? $fileName : ($folderKey . '/' . $fileName), |
| 103 | ]); |
| 104 | return fopen($this->path, 'rb'); |
| 105 | } |
| 106 | |
| 107 | public function put($data): ?string |
| 108 | { |
no test coverage detected