Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable24] Emit read hook instead of fopen for admin_audit #2224

Merged
merged 1 commit into from
May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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