From e991b23d9d74a7d8af9d7f824a5bbeaf1e629604 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 9 Jun 2016 20:10:26 +0200 Subject: [PATCH] log events from versions app --- apps/admin_audit/lib/actions/versions.php | 45 +++++++++++++++++++++++ apps/admin_audit/lib/auditlogger.php | 8 ++++ 2 files changed, 53 insertions(+) create mode 100644 apps/admin_audit/lib/actions/versions.php diff --git a/apps/admin_audit/lib/actions/versions.php b/apps/admin_audit/lib/actions/versions.php new file mode 100644 index 0000000000..006c33bf04 --- /dev/null +++ b/apps/admin_audit/lib/actions/versions.php @@ -0,0 +1,45 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + + +namespace OCA\Admin_Audit\Actions; + + +class Versions extends Action { + + public function rollback($params) { + $this->log('Version "%s" of "%s" was restored.', + [ + 'version' => $params['revision'], + 'path' => $params['path'] + ], + ['version', 'path'] + ); + } + + public function delete($params) { + $this->log('Version "%s" was deleted.', + ['path' => $params['path']], + ['path'] + ); + } + +} diff --git a/apps/admin_audit/lib/auditlogger.php b/apps/admin_audit/lib/auditlogger.php index e3cfd42f5d..f7dae10701 100644 --- a/apps/admin_audit/lib/auditlogger.php +++ b/apps/admin_audit/lib/auditlogger.php @@ -30,6 +30,7 @@ use OCA\Admin_Audit\Actions\GroupManagement; use OCA\Admin_Audit\Actions\Sharing; use OCA\Admin_Audit\Actions\Trashbin; use OCA\Admin_Audit\Actions\UserManagement; +use OCA\Admin_Audit\Actions\Versions; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUserSession; @@ -71,6 +72,7 @@ class AuditLogger { $this->authHooks(); $this->fileHooks(); $this->trashbinHooks(); + $this->versionsHooks(); } /** @@ -166,6 +168,12 @@ class AuditLogger { ); } + public function versionsHooks() { + $versionsActions = new Versions($this->logger); + Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); + Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); + } + /** * connect to trash bin hooks */