Skip to content

Commit

Permalink
Merge pull request #2224 from nextcloud/backport/1957/stable24
Browse files Browse the repository at this point in the history
[stable24] Emit read hook instead of fopen for admin_audit
  • Loading branch information
Raudius committed May 18, 2022
2 parents e4bb4a6 + b381f9d commit 2f3ada0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace OCA\Richdocuments;

use InvalidArgumentException;
use OC\Files\Filesystem;
use OCA\Richdocuments\Db\Direct;
use OCA\Richdocuments\Db\WopiMapper;
use OCA\Richdocuments\Db\Wopi;
Expand Down Expand Up @@ -191,8 +192,11 @@ public function getToken($fileId, $shareToken = null, $editoruid = null, $direct
}

// force read operation to trigger possible audit logging
$fp = $file->fopen('r');
fclose($fp);
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_read,
[Filesystem::signal_param_path => $file->getPath()]
);

$serverHost = $this->urlGenerator->getAbsoluteURL('/');
$guestName = $this->userId === null ? $this->prepareGuestName($this->helper->getGuestNameFromCookie()) : null;
Expand Down

0 comments on commit 2f3ada0

Please sign in to comment.