summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/appinfo/app.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/admin_audit/appinfo/app.php')
-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();