diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-23 22:34:55 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-05-07 09:04:07 +0200 |
commit | 1e12db35ee3b7ec96577129c6895c878e6204666 (patch) | |
tree | bf2f4152e313d72a347209cf6612ee9d11859d41 /apps/admin_audit | |
parent | 640ba1828f3edfdd2e71825828c51b734fb19d1c (diff) | |
download | nextcloud-server-1e12db35ee3b7ec96577129c6895c878e6204666.tar.gz nextcloud-server-1e12db35ee3b7ec96577129c6895c878e6204666.zip |
Audit: Add user login/logout logging
Diffstat (limited to 'apps/admin_audit')
-rw-r--r-- | apps/admin_audit/appinfo/app.php | 4 | ||||
-rw-r--r-- | apps/admin_audit/lib/hooks_handlers.php | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/apps/admin_audit/appinfo/app.php b/apps/admin_audit/appinfo/app.php index b1b986fb7ba..27a72de432c 100644 --- a/apps/admin_audit/appinfo/app.php +++ b/apps/admin_audit/appinfo/app.php @@ -2,6 +2,10 @@ OC::$CLASSPATH['OC_Admin_Audit_Hooks_Handlers'] = 'apps/admin_audit/lib/hooks_handlers.php'; +OCP\Util::connectHook('OCP\User', 'pre_login', 'OC_Admin_Audit_Hooks_Handlers', 'pre_login'); +OCP\Util::connectHook('OCP\User', 'post_login', 'OC_Admin_Audit_Hooks_Handlers', 'post_login'); +OCP\Util::connectHook('OCP\User', 'logout', 'OC_Admin_Audit_Hooks_Handlers', 'logout'); + OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename, 'OC_Admin_Audit_Hooks_Handlers', 'rename'); OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, 'OC_Admin_Audit_Hooks_Handlers', 'create'); OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, 'OC_Admin_Audit_Hooks_Handlers', 'copy'); diff --git a/apps/admin_audit/lib/hooks_handlers.php b/apps/admin_audit/lib/hooks_handlers.php index 924878840a2..8ebabbac7b5 100644 --- a/apps/admin_audit/lib/hooks_handlers.php +++ b/apps/admin_audit/lib/hooks_handlers.php @@ -1,6 +1,19 @@ <?php class OC_Admin_Audit_Hooks_Handlers { + static public function pre_login($params) { + $path = $params['uid']; + OCP\Util::writeLog('admin_audit', 'Trying login '.$user, OCP\Util::INFO); + } + static public function post_login($params) { + $path = $params['uid']; + OCP\Util::writeLog('admin_audit', 'Login '.$user, OCP\Util::INFO); + } + static public function logout($params) { + $user = OCP\User::getUser(); + OCP\Util::writeLog('admin_audit', 'Logout '.$user, OCP\Util::INFO); + } + static public function rename($params) { $oldpath = $params[OC_Filesystem::signal_param_oldpath]; $newpath = $params[OC_Filesystem::signal_param_newpath]; |