MCPcopy Create free account
hub / github.com/error311/FileRise / get

Method get

src/FileRise/WebDAV/FileRiseFile.php:85–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers 1

updateMetadataMethod · 0.45

Calls 6

splitMethod · 0.95
isOwnerMethod · 0.95
isEncryptedOrAncestorMethod · 0.80
canReadMethod · 0.80
hasGrantMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected