summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/appinfo
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2016-06-09 18:03:31 +0200
committerLukas Reschke <lukas@owncloud.com>2016-06-10 15:38:57 +0200
commit86f12cc3e75e8d08985b7ec7bd2d1a8b91070df1 (patch)
tree6c04a949730973e9f7ca8a6f09fb94f8f7859057 /apps/admin_audit/appinfo
parentaa831252b333c3fbd9ac580f9c584831f5a11f9d (diff)
downloadnextcloud-server-86f12cc3e75e8d08985b7ec7bd2d1a8b91070df1.tar.gz
nextcloud-server-86f12cc3e75e8d08985b7ec7bd2d1a8b91070df1.zip
listen to trash bin and group manager hooks
Diffstat (limited to 'apps/admin_audit/appinfo')
-rw-r--r--apps/admin_audit/appinfo/app.php123
1 files changed, 4 insertions, 119 deletions
diff --git a/apps/admin_audit/appinfo/app.php b/apps/admin_audit/appinfo/app.php
index 4418ada2ed0..ea5fb0286bf 100644
--- a/apps/admin_audit/appinfo/app.php
+++ b/apps/admin_audit/appinfo/app.php
@@ -20,123 +20,8 @@
*/
$logger = \OC::$server->getLogger();
+$userSession = \OC::$server->getUserSession();
+$groupManager = \OC::$server->getGroupManager();
-logUserManagement(
- $logger,
- \OC::$server->getUserSession()
-);
-logFileActions($logger);
-logAuthEvents($logger);
-logShareEvents($logger);
-
-/**
- * Logs sharing events
- *
- * @param \OCP\ILogger $logger
- */
-function logShareEvents($logger) {
- $shareActions = new \OCA\Admin_Audit\Actions\Sharing(
- $logger
- );
-
- OCP\Util::connectHook('OCP\Share', 'post_shared', $shareActions, 'shared');
- OCP\Util::connectHook('OCP\Share', 'post_unshare', $shareActions, 'unshare');
- OCP\Util::connectHook('OCP\Share', 'post_update_permissions', $shareActions, 'updatePermissions');
- OCP\Util::connectHook('OCP\Share', 'post_update_password', $shareActions, 'updatePassword');
- OCP\Util::connectHook('OCP\Share', 'post_set_expiration_date', $shareActions, 'updateExpirationDate');
- OCP\Util::connectHook('OCP\Share', 'share_link_access', $shareActions, 'shareAccessed');
-}
-
-/**
- * Log authentication event related actions
- *
- * @param \OCP\ILogger $logger
- */
-function logAuthEvents($logger) {
- $authActions = new \OCA\Admin_Audit\Actions\Auth(
- $logger
- );
- OCP\Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt');
- OCP\Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful');
- OCP\Util::connectHook('OC_User', 'logout', $authActions, 'logout');
-}
-
-/**
- * Log user management related actions
- *
- * @param \OCP\ILogger $logger
- * @param \OC\User\Session $userSession
- */
-function logUserManagement($logger, $userSession) {
- $userActions = new \OCA\Admin_Audit\Actions\UserManagement(
- $logger
- );
-
- OCP\Util::connectHook(
- 'OC_User',
- 'post_createUser',
- $userActions,
- 'create'
- );
- OCP\Util::connectHook(
- 'OC_User',
- 'post_deleteUser',
- $userActions,
- 'delete'
- );
- $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']);
-}
-
-/**
- * Log file related actions
- *
- * @param \OCP\ILogger $logger
- */
-function logFileActions($logger) {
- $fileActions = new \OCA\Admin_Audit\Actions\Files(
- $logger
- );
-
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_post_rename,
- $fileActions,
- 'rename'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_post_create,
- $fileActions,
- 'create'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_post_copy,
- $fileActions,
- 'copy'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_post_write,
- $fileActions,
- 'write'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_post_update,
- $fileActions,
- 'update'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_read,
- $fileActions,
- 'read'
- );
- OCP\Util::connectHook(
- OC\Files\Filesystem::CLASSNAME,
- OC\Files\Filesystem::signal_delete,
- $fileActions,
- 'delete'
- );
-}
+$auditLogger = new \OCA\Admin_Audit\AuditLogger($logger, $userSession, $groupManager);
+$auditLogger->registerHooks();