aboutsummaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/lib/AppInfo/Application.php
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-04-09 12:10:12 +0530
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-04-30 11:31:01 +0200
commit4d228803f7fb009882e3ea909c6998237503eb6f (patch)
tree24eed001a584889ac3faa3ab7ff3128f97f43da3 /apps/admin_audit/lib/AppInfo/Application.php
parentcb27fbc3bb9423ee5b4c7e30df46de14ba33ec9b (diff)
downloadnextcloud-server-4d228803f7fb009882e3ea909c6998237503eb6f.tar.gz
nextcloud-server-4d228803f7fb009882e3ea909c6998237503eb6f.zip
feat: include file id in audit logs
Signed-off-by: yemkareems <yemkareems@gmail.com>
Diffstat (limited to 'apps/admin_audit/lib/AppInfo/Application.php')
-rw-r--r--apps/admin_audit/lib/AppInfo/Application.php93
1 files changed, 49 insertions, 44 deletions
diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php
index 860b7b70ae6..be060dc89a0 100644
--- a/apps/admin_audit/lib/AppInfo/Application.php
+++ b/apps/admin_audit/lib/AppInfo/Application.php
@@ -33,7 +33,6 @@ declare(strict_types=1);
*/
namespace OCA\AdminAudit\AppInfo;
-use OC\Files\Filesystem;
use OC\Group\Manager as GroupManager;
use OC\User\Session as UserSession;
use OCA\AdminAudit\Actions\AppManagement;
@@ -58,6 +57,13 @@ use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed;
use OCP\Console\ConsoleEvent;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Events\Node\BeforeNodeReadEvent;
+use OCP\Files\Events\Node\BeforeNodeWrittenEvent;
+use OCP\Files\Events\Node\NodeCopiedEvent;
+use OCP\Files\Events\Node\NodeCreatedEvent;
+use OCP\Files\Events\Node\NodeDeletedEvent;
+use OCP\Files\Events\Node\NodeRenamedEvent;
+use OCP\Files\Events\Node\NodeWrittenEvent;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUserSession;
@@ -195,58 +201,57 @@ class Application extends App implements IBootstrap {
$eventDispatcher->addListener(
BeforePreviewFetchedEvent::class,
function (BeforePreviewFetchedEvent $event) use ($fileActions) {
- $file = $event->getNode();
- $fileActions->preview([
- 'path' => mb_substr($file->getInternalPath(), 5),
- 'width' => $event->getWidth(),
- 'height' => $event->getHeight(),
- 'crop' => $event->isCrop(),
- 'mode' => $event->getMode()
- ]);
+ $fileActions->preview($event);
}
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_post_rename,
- $fileActions,
- 'rename'
+ $eventDispatcher->addListener(
+ NodeRenamedEvent::class,
+ function (NodeRenamedEvent $event) use ($fileActions) {
+ $fileActions->rename($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_post_create,
- $fileActions,
- 'create'
+
+ $eventDispatcher->addListener(
+ NodeCreatedEvent::class,
+ function (NodeCreatedEvent $event) use ($fileActions) {
+ $fileActions->create($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_post_copy,
- $fileActions,
- 'copy'
+
+ $eventDispatcher->addListener(
+ NodeCopiedEvent::class,
+ function (NodeCopiedEvent $event) use ($fileActions) {
+ $fileActions->copy($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_post_write,
- $fileActions,
- 'write'
+
+ $eventDispatcher->addListener(
+ BeforeNodeWrittenEvent::class,
+ function (BeforeNodeWrittenEvent $event) use ($fileActions) {
+ $fileActions->write($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_post_update,
- $fileActions,
- 'update'
+
+ $eventDispatcher->addListener(
+ NodeWrittenEvent::class,
+ function (NodeWrittenEvent $event) use ($fileActions) {
+ $fileActions->update($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_read,
- $fileActions,
- 'read'
+
+ $eventDispatcher->addListener(
+ BeforeNodeReadEvent::class,
+ function (BeforeNodeReadEvent $event) use ($fileActions) {
+ $fileActions->read($event);
+ }
);
- Util::connectHook(
- Filesystem::CLASSNAME,
- Filesystem::signal_delete,
- $fileActions,
- 'delete'
+
+ $eventDispatcher->addListener(
+ NodeDeletedEvent::class,
+ function (NodeDeletedEvent $event) use ($fileActions) {
+ $fileActions->delete($event);
+ }
);
}