Skip to content

Commit

Permalink
Emit read hook instead of fopen for admin_audit
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jan 3, 2022
1 parent 368fd1e commit 7308f9c
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 7308f9c

Please sign in to comment.