summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/lib/hooks_handlers.php
blob: 4cc3194eaf19bcdf816897fa799a73570e8bcae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

class OC_Admin_Audit_Hooks_Handlers {
	static public function pre_login($params) {
		$path = $params['uid'];
		self::log('Trying login '.$user);
	}
	static public function post_login($params) {
		$path = $params['uid'];
		self::log('Login '.$user);
	}
	static public function logout($params) {
		$user = OCP\User::getUser();
		self::log('Logout '.$user);
	}

	static public function rename($params) {
		$oldpath = $params[OC_Filesystem::signal_param_oldpath];
		$newpath = $params[OC_Filesystem::signal_param_newpath];
		$user = OCP\User::getUser();
		self::log('Rename "'.$oldpath.'" to "'.$newpath.'" by '.$user);
	}
	static public function create($params) {
		$path = $params[OC_Filesystem::signal_param_path];
		$user = OCP\User::getUser();
		self::log('Create "'.$path.'" by '.$user);
	}
	static public function copy($params) {
		$oldpath = $params[OC_Filesystem::signal_param_oldpath];
		$newpath = $params[OC_Filesystem::signal_param_newpath];
		$user = OCP\User::getUser();
		self::log('Copy "'.$oldpath.'" to "'.$newpath.'" by '.$user);
	}
	static public function write($params) {
		$path = $params[OC_Filesystem::signal_param_path];
		$user = OCP\User::getUser();
		self::log('Write "'.$path.'" by '.$user);
	}
	static public function read($params) {
		$path = $params[OC_Filesystem::signal_param_path];
		$user = OCP\User::getUser();
		self::log('Read "'.$path.'" by '.$user);
	}
	static public function delete($params) {
		$path = $params[OC_Filesystem::signal_param_path];
		$user = OCP\User::getUser();
		self::log('Delete "'.$path.'" by '.$user);
	}
	static protected function log($msg) {
		OCP\Util::writeLog('admin_audit', $msg, OCP\Util::INFO);
	}
}