Audit: Add user login/logout logging

This commit is contained in:
Bart Visscher 2012-03-23 22:34:55 +01:00
parent 640ba1828f
commit 1e12db35ee
2 changed files with 17 additions and 0 deletions

View file

@ -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');

View file

@ -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];