summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-04-13 19:40:33 +0200
committerBart Visscher <bartv@thisnet.nl>2012-05-07 09:04:07 +0200
commit2d581c675fb488df0875e4a489821cf88b7679ac (patch)
tree4180d67536e781d399e2b6336e2a8b49ca8abd7b /apps/admin_audit
parenta2df8a4746dd9c355541501e78726daaa6dbec43 (diff)
downloadnextcloud-server-2d581c675fb488df0875e4a489821cf88b7679ac.tar.gz
nextcloud-server-2d581c675fb488df0875e4a489821cf88b7679ac.zip
Audit: Log sharing actions
Diffstat (limited to 'apps/admin_audit')
-rw-r--r--apps/admin_audit/appinfo/app.php4
-rw-r--r--apps/admin_audit/lib/hooks_handlers.php20
2 files changed, 24 insertions, 0 deletions
diff --git a/apps/admin_audit/appinfo/app.php b/apps/admin_audit/appinfo/app.php
index 27a72de432c..e52f633cf14 100644
--- a/apps/admin_audit/appinfo/app.php
+++ b/apps/admin_audit/appinfo/app.php
@@ -12,3 +12,7 @@ OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, 'OC_
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, 'OC_Admin_Audit_Hooks_Handlers', 'write');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_read, 'OC_Admin_Audit_Hooks_Handlers', 'read');
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, 'OC_Admin_Audit_Hooks_Handlers', 'delete');
+
+OCP\Util::connectHook('OC_Share', 'public', 'OC_Admin_Audit_Hooks_Handlers', 'share_public');
+OCP\Util::connectHook('OC_Share', 'public-download', 'OC_Admin_Audit_Hooks_Handlers', 'share_public_download');
+OCP\Util::connectHook('OC_Share', 'user', 'OC_Admin_Audit_Hooks_Handlers', 'share_user');
diff --git a/apps/admin_audit/lib/hooks_handlers.php b/apps/admin_audit/lib/hooks_handlers.php
index 4cc3194eaf1..c5aec97d939 100644
--- a/apps/admin_audit/lib/hooks_handlers.php
+++ b/apps/admin_audit/lib/hooks_handlers.php
@@ -46,6 +46,26 @@ class OC_Admin_Audit_Hooks_Handlers {
$user = OCP\User::getUser();
self::log('Delete "'.$path.'" by '.$user);
}
+ static public function share_public($params) {
+ $path = $params['source'];
+ $token = $params['token'];
+ $user = OCP\User::getUser();
+ self::log('Shared "'.$path.'" with public, token="'.$token.'" by '.$user);
+ }
+ static public function share_public_download($params) {
+ $path = $params['source'];
+ $token = $params['token'];
+ $user = $_SERVER['REMOTE_ADDR'];
+ self::log('Download of shared "'.$path.'" token="'.$token.'" by '.$user);
+ }
+ static public function share_user($params) {
+ $path = $params['source'];
+ $permissions = $params['permissions'];
+ $with = $params['with'];
+ $user = OCP\User::getUser();
+ $rw = $permissions & OC_Share::WRITE ? 'w' : 'o';
+ self::log('Shared "'.$path.'" (r'.$rw.') with user "'.$with.'" by '.$user);
+ }
static protected function log($msg) {
OCP\Util::writeLog('admin_audit', $msg, OCP\Util::INFO);
}