diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-06-09 20:10:26 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-10 15:39:04 +0200 |
commit | e991b23d9d74a7d8af9d7f824a5bbeaf1e629604 (patch) | |
tree | d8f8117205a593cf08373da9e9c43083efcaf10f /apps/admin_audit | |
parent | 86f12cc3e75e8d08985b7ec7bd2d1a8b91070df1 (diff) | |
download | nextcloud-server-e991b23d9d74a7d8af9d7f824a5bbeaf1e629604.tar.gz nextcloud-server-e991b23d9d74a7d8af9d7f824a5bbeaf1e629604.zip |
log events from versions app
Diffstat (limited to 'apps/admin_audit')
-rw-r--r-- | apps/admin_audit/lib/actions/versions.php | 45 | ||||
-rw-r--r-- | apps/admin_audit/lib/auditlogger.php | 8 |
2 files changed, 53 insertions, 0 deletions
diff --git a/apps/admin_audit/lib/actions/versions.php b/apps/admin_audit/lib/actions/versions.php new file mode 100644 index 00000000000..006c33bf04f --- /dev/null +++ b/apps/admin_audit/lib/actions/versions.php @@ -0,0 +1,45 @@ +<?php +/** + * @copyright Bjoern Schiessle <bjoern@schiessle.org> + * + * @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 <http://www.gnu.org/licenses/>. + * + */ + + +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 e3cfd42f5d0..f7dae10701f 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 */ |