@@ -32,10 +32,10 @@ |
||
32 | 32 | |
33 | 33 | // make filelist |
34 | 34 | try { |
35 | - $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection); |
|
35 | + $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection); |
|
36 | 36 | } catch (Exception $e) { |
37 | - header("HTTP/1.0 404 Not Found"); |
|
38 | - exit(); |
|
37 | + header("HTTP/1.0 404 Not Found"); |
|
38 | + exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $encodedDir = \OCP\Util::encodePath($dir); |
@@ -25,8 +25,8 @@ |
||
25 | 25 | \OC::$server->getSession()->close(); |
26 | 26 | |
27 | 27 | // Load the files |
28 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
29 | -$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name'; |
|
28 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
29 | +$sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name'; |
|
30 | 30 | $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false; |
31 | 31 | $data = array(); |
32 | 32 |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | |
33 | 33 | // "empty trash" command |
34 | 34 | if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true'){ |
35 | - $deleteAll = true; |
|
36 | - if ($folder === '/' || $folder === '') { |
|
37 | - OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
38 | - $list = array(); |
|
39 | - } else { |
|
40 | - $list[] = $folder; |
|
41 | - $folder = dirname($folder); |
|
42 | - } |
|
35 | + $deleteAll = true; |
|
36 | + if ($folder === '/' || $folder === '') { |
|
37 | + OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
38 | + $list = array(); |
|
39 | + } else { |
|
40 | + $list[] = $folder; |
|
41 | + $folder = dirname($folder); |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | else { |
45 | - $deleteAll = false; |
|
46 | - $files = (string)$_POST['files']; |
|
47 | - $list = json_decode($files); |
|
45 | + $deleteAll = false; |
|
46 | + $files = (string)$_POST['files']; |
|
47 | + $list = json_decode($files); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $folder = rtrim($folder, '/') . '/'; |
@@ -53,38 +53,38 @@ discard block |
||
53 | 53 | |
54 | 54 | $i = 0; |
55 | 55 | foreach ($list as $file) { |
56 | - if ($folder === '/') { |
|
57 | - $file = ltrim($file, '/'); |
|
58 | - $delimiter = strrpos($file, '.d'); |
|
59 | - $filename = substr($file, 0, $delimiter); |
|
60 | - $timestamp = substr($file, $delimiter+2); |
|
61 | - } else { |
|
62 | - $filename = $folder . '/' . $file; |
|
63 | - $timestamp = null; |
|
64 | - } |
|
56 | + if ($folder === '/') { |
|
57 | + $file = ltrim($file, '/'); |
|
58 | + $delimiter = strrpos($file, '.d'); |
|
59 | + $filename = substr($file, 0, $delimiter); |
|
60 | + $timestamp = substr($file, $delimiter+2); |
|
61 | + } else { |
|
62 | + $filename = $folder . '/' . $file; |
|
63 | + $timestamp = null; |
|
64 | + } |
|
65 | 65 | |
66 | - OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp); |
|
67 | - if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { |
|
68 | - $error[] = $filename; |
|
69 | - \OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR); |
|
70 | - } |
|
71 | - // only list deleted files if not deleting everything |
|
72 | - else if (!$deleteAll) { |
|
73 | - $success[$i]['filename'] = $file; |
|
74 | - $success[$i]['timestamp'] = $timestamp; |
|
75 | - $i++; |
|
76 | - } |
|
66 | + OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp); |
|
67 | + if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { |
|
68 | + $error[] = $filename; |
|
69 | + \OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR); |
|
70 | + } |
|
71 | + // only list deleted files if not deleting everything |
|
72 | + else if (!$deleteAll) { |
|
73 | + $success[$i]['filename'] = $file; |
|
74 | + $success[$i]['timestamp'] = $timestamp; |
|
75 | + $i++; |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if ( $error ) { |
80 | - $filelist = ''; |
|
81 | - foreach ( $error as $e ) { |
|
82 | - $filelist .= $e.', '; |
|
83 | - } |
|
84 | - $l = \OC::$server->getL10N('files_trashbin'); |
|
85 | - $message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', '))); |
|
86 | - OCP\JSON::error(array("data" => array("message" => $message, |
|
87 | - "success" => $success, "error" => $error))); |
|
80 | + $filelist = ''; |
|
81 | + foreach ( $error as $e ) { |
|
82 | + $filelist .= $e.', '; |
|
83 | + } |
|
84 | + $l = \OC::$server->getL10N('files_trashbin'); |
|
85 | + $message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', '))); |
|
86 | + OCP\JSON::error(array("data" => array("message" => $message, |
|
87 | + "success" => $success, "error" => $error))); |
|
88 | 88 | } else { |
89 | - OCP\JSON::success(array("data" => array("success" => $success))); |
|
89 | + OCP\JSON::success(array("data" => array("success" => $success))); |
|
90 | 90 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $folder = isset($_POST['dir']) ? $_POST['dir'] : '/'; |
32 | 32 | |
33 | 33 | // "empty trash" command |
34 | -if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true'){ |
|
34 | +if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') { |
|
35 | 35 | $deleteAll = true; |
36 | 36 | if ($folder === '/' || $folder === '') { |
37 | 37 | OCA\Files_Trashbin\Trashbin::deleteAll(); |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | } |
44 | 44 | else { |
45 | 45 | $deleteAll = false; |
46 | - $files = (string)$_POST['files']; |
|
46 | + $files = (string) $_POST['files']; |
|
47 | 47 | $list = json_decode($files); |
48 | 48 | } |
49 | 49 | |
50 | -$folder = rtrim($folder, '/') . '/'; |
|
50 | +$folder = rtrim($folder, '/').'/'; |
|
51 | 51 | $error = array(); |
52 | 52 | $success = array(); |
53 | 53 | |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | $file = ltrim($file, '/'); |
58 | 58 | $delimiter = strrpos($file, '.d'); |
59 | 59 | $filename = substr($file, 0, $delimiter); |
60 | - $timestamp = substr($file, $delimiter+2); |
|
60 | + $timestamp = substr($file, $delimiter + 2); |
|
61 | 61 | } else { |
62 | - $filename = $folder . '/' . $file; |
|
62 | + $filename = $folder.'/'.$file; |
|
63 | 63 | $timestamp = null; |
64 | 64 | } |
65 | 65 | |
66 | 66 | OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp); |
67 | 67 | if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { |
68 | 68 | $error[] = $filename; |
69 | - \OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR); |
|
69 | + \OCP\Util::writeLog('trashbin', 'can\'t delete '.$filename.' permanently.', \OCP\Util::ERROR); |
|
70 | 70 | } |
71 | 71 | // only list deleted files if not deleting everything |
72 | 72 | else if (!$deleteAll) { |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | -if ( $error ) { |
|
79 | +if ($error) { |
|
80 | 80 | $filelist = ''; |
81 | - foreach ( $error as $e ) { |
|
81 | + foreach ($error as $e) { |
|
82 | 82 | $filelist .= $e.', '; |
83 | 83 | } |
84 | 84 | $l = \OC::$server->getL10N('files_trashbin'); |
@@ -40,8 +40,7 @@ |
||
40 | 40 | $list[] = $folder; |
41 | 41 | $folder = dirname($folder); |
42 | 42 | } |
43 | -} |
|
44 | -else { |
|
43 | +} else { |
|
45 | 44 | $deleteAll = false; |
46 | 45 | $files = (string)$_POST['files']; |
47 | 46 | $list = json_decode($files); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $newObligation = 'auto'; |
32 | 32 | if ($isExpirationEnabled) { |
33 | 33 | if (!is_null($oldObligation)) { |
34 | - $newObligation = strval($oldObligation) . ', auto'; |
|
34 | + $newObligation = strval($oldObligation).', auto'; |
|
35 | 35 | } |
36 | 36 | } else { |
37 | 37 | $newObligation = 'disabled'; |
@@ -25,20 +25,20 @@ |
||
25 | 25 | $installedVersion = $config->getAppValue('files_trashbin', 'installed_version'); |
26 | 26 | |
27 | 27 | if (version_compare($installedVersion, '0.6.4', '<')) { |
28 | - $isExpirationEnabled = $config->getSystemValue('trashbin_auto_expire', true); |
|
29 | - $oldObligation = $config->getSystemValue('trashbin_retention_obligation', null); |
|
28 | + $isExpirationEnabled = $config->getSystemValue('trashbin_auto_expire', true); |
|
29 | + $oldObligation = $config->getSystemValue('trashbin_retention_obligation', null); |
|
30 | 30 | |
31 | - $newObligation = 'auto'; |
|
32 | - if ($isExpirationEnabled) { |
|
33 | - if (!is_null($oldObligation)) { |
|
34 | - $newObligation = strval($oldObligation) . ', auto'; |
|
35 | - } |
|
36 | - } else { |
|
37 | - $newObligation = 'disabled'; |
|
38 | - } |
|
31 | + $newObligation = 'auto'; |
|
32 | + if ($isExpirationEnabled) { |
|
33 | + if (!is_null($oldObligation)) { |
|
34 | + $newObligation = strval($oldObligation) . ', auto'; |
|
35 | + } |
|
36 | + } else { |
|
37 | + $newObligation = 'disabled'; |
|
38 | + } |
|
39 | 39 | |
40 | - $config->setSystemValue('trashbin_retention_obligation', $newObligation); |
|
41 | - $config->deleteSystemValue('trashbin_auto_expire'); |
|
40 | + $config->setSystemValue('trashbin_retention_obligation', $newObligation); |
|
41 | + $config->deleteSystemValue('trashbin_auto_expire'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Cron job for deleting expired trash items |
@@ -32,10 +32,10 @@ |
||
32 | 32 | |
33 | 33 | \OCA\Files\App::getNavigationManager()->add( |
34 | 34 | array( |
35 | - "id" => 'trashbin', |
|
36 | - "appname" => 'files_trashbin', |
|
37 | - "script" => 'list.php', |
|
38 | - "order" => 50, |
|
39 | - "name" => $l->t('Deleted files') |
|
35 | + "id" => 'trashbin', |
|
36 | + "appname" => 'files_trashbin', |
|
37 | + "script" => 'list.php', |
|
38 | + "order" => 50, |
|
39 | + "name" => $l->t('Deleted files') |
|
40 | 40 | ) |
41 | 41 | ); |
@@ -28,10 +28,10 @@ |
||
28 | 28 | <?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
29 | 29 | <span class="status success"></span> |
30 | 30 | <?php |
31 | - } elseif( |
|
32 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
33 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
34 | - ) { ?> |
|
31 | + } elseif( |
|
32 | + (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
33 | + (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
34 | + ) { ?> |
|
35 | 35 | <span class="status indeterminate"></span> |
36 | 36 | <?php } else {?> |
37 | 37 | <span class="status error"></span> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | <em><?php p($l->t('Nextcloud Federation allows you to connect with other trusted Nextclouds to exchange the user directory. For example this will be used to auto-complete external users for federated sharing.')); ?></em> |
12 | 12 | |
13 | 13 | <p> |
14 | - <input id="autoAddServers" type="checkbox" class="checkbox" <?php if($_['autoAddServers']) p('checked'); ?> /> |
|
14 | + <input id="autoAddServers" type="checkbox" class="checkbox" <?php if ($_['autoAddServers']) p('checked'); ?> /> |
|
15 | 15 | <label for="autoAddServers"><?php p($l->t('Add server automatically once a federated share was created successfully')) ?></label> |
16 | 16 | </p> |
17 | 17 | |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | <span class="msg"></span> |
23 | 23 | </p> |
24 | 24 | <ul id="listOfTrustedServers"> |
25 | - <?php foreach($_['trustedServers'] as $trustedServer) { ?> |
|
25 | + <?php foreach ($_['trustedServers'] as $trustedServer) { ?> |
|
26 | 26 | <li id="<?php p($trustedServer['id']); ?>" class="icon-delete"> |
27 | - <?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
27 | + <?php if ((int) $trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
28 | 28 | <span class="status success"></span> |
29 | 29 | <?php |
30 | - } elseif( |
|
31 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
32 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
30 | + } elseif ( |
|
31 | + (int) $trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
32 | + (int) $trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
33 | 33 | ) { ?> |
34 | 34 | <span class="status indeterminate"></span> |
35 | 35 | <?php } else {?> |
@@ -11,7 +11,10 @@ |
||
11 | 11 | <em><?php p($l->t('Nextcloud Federation allows you to connect with other trusted Nextclouds to exchange the user directory. For example this will be used to auto-complete external users for federated sharing.')); ?></em> |
12 | 12 | |
13 | 13 | <p> |
14 | - <input id="autoAddServers" type="checkbox" class="checkbox" <?php if($_['autoAddServers']) p('checked'); ?> /> |
|
14 | + <input id="autoAddServers" type="checkbox" class="checkbox" <?php if($_['autoAddServers']) { |
|
15 | + p('checked'); |
|
16 | +} |
|
17 | +?> /> |
|
15 | 18 | <label for="autoAddServers"><?php p($l->t('Add server automatically once a federated share was created successfully')) ?></label> |
16 | 19 | </p> |
17 | 20 |
@@ -40,149 +40,149 @@ |
||
40 | 40 | |
41 | 41 | class AuditLogger { |
42 | 42 | |
43 | - /** @var ILogger */ |
|
44 | - private $logger; |
|
43 | + /** @var ILogger */ |
|
44 | + private $logger; |
|
45 | 45 | |
46 | - /** @var IUserSession */ |
|
47 | - private $userSession; |
|
46 | + /** @var IUserSession */ |
|
47 | + private $userSession; |
|
48 | 48 | |
49 | - /** @var IGroupManager */ |
|
50 | - private $groupManager; |
|
51 | - |
|
52 | - /** |
|
53 | - * AuditLogger constructor. |
|
54 | - * |
|
55 | - * @param ILogger $logger |
|
56 | - * @param IUserSession $userSession |
|
57 | - * @param IGroupManager $groupManager |
|
58 | - */ |
|
59 | - public function __construct(ILogger $logger, |
|
60 | - IUserSession $userSession, |
|
61 | - IGroupManager $groupManager) { |
|
62 | - $this->logger = $logger; |
|
63 | - $this->userSession = $userSession; |
|
64 | - $this->groupManager = $groupManager; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * register hooks in order to log them |
|
69 | - */ |
|
70 | - public function registerHooks() { |
|
71 | - $this->userManagementHooks(); |
|
72 | - $this->groupHooks(); |
|
73 | - $this->sharingHooks(); |
|
74 | - $this->authHooks(); |
|
75 | - $this->fileHooks(); |
|
76 | - $this->trashbinHooks(); |
|
77 | - $this->versionsHooks(); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * connect to user management hooks |
|
82 | - */ |
|
83 | - private function userManagementHooks() { |
|
84 | - $userActions = new UserManagement($this->logger); |
|
85 | - |
|
86 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
87 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
88 | - $this->userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
89 | - } |
|
49 | + /** @var IGroupManager */ |
|
50 | + private $groupManager; |
|
51 | + |
|
52 | + /** |
|
53 | + * AuditLogger constructor. |
|
54 | + * |
|
55 | + * @param ILogger $logger |
|
56 | + * @param IUserSession $userSession |
|
57 | + * @param IGroupManager $groupManager |
|
58 | + */ |
|
59 | + public function __construct(ILogger $logger, |
|
60 | + IUserSession $userSession, |
|
61 | + IGroupManager $groupManager) { |
|
62 | + $this->logger = $logger; |
|
63 | + $this->userSession = $userSession; |
|
64 | + $this->groupManager = $groupManager; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * register hooks in order to log them |
|
69 | + */ |
|
70 | + public function registerHooks() { |
|
71 | + $this->userManagementHooks(); |
|
72 | + $this->groupHooks(); |
|
73 | + $this->sharingHooks(); |
|
74 | + $this->authHooks(); |
|
75 | + $this->fileHooks(); |
|
76 | + $this->trashbinHooks(); |
|
77 | + $this->versionsHooks(); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * connect to user management hooks |
|
82 | + */ |
|
83 | + private function userManagementHooks() { |
|
84 | + $userActions = new UserManagement($this->logger); |
|
85 | + |
|
86 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
87 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
88 | + $this->userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
89 | + } |
|
90 | 90 | |
91 | - private function groupHooks() { |
|
92 | - $groupActions = new GroupManagement($this->logger); |
|
93 | - $this->groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
94 | - $this->groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * connect to sharing events |
|
99 | - */ |
|
100 | - private function sharingHooks() { |
|
101 | - $shareActions = new Sharing($this->logger); |
|
102 | - |
|
103 | - Util::connectHook('OCP\Share', 'post_shared', $shareActions, 'shared'); |
|
104 | - Util::connectHook('OCP\Share', 'post_unshare', $shareActions, 'unshare'); |
|
105 | - Util::connectHook('OCP\Share', 'post_update_permissions', $shareActions, 'updatePermissions'); |
|
106 | - Util::connectHook('OCP\Share', 'post_update_password', $shareActions, 'updatePassword'); |
|
107 | - Util::connectHook('OCP\Share', 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); |
|
108 | - Util::connectHook('OCP\Share', 'share_link_access', $shareActions, 'shareAccessed'); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * connect to authentication event and related actions |
|
113 | - */ |
|
114 | - private function authHooks() { |
|
115 | - $authActions = new Auth($this->logger); |
|
116 | - |
|
117 | - Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
118 | - Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
119 | - Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * connect to file hooks |
|
125 | - */ |
|
126 | - private function fileHooks() { |
|
127 | - $fileActions = new Files($this->logger); |
|
128 | - |
|
129 | - Util::connectHook( |
|
130 | - Filesystem::CLASSNAME, |
|
131 | - Filesystem::signal_post_rename, |
|
132 | - $fileActions, |
|
133 | - 'rename' |
|
134 | - ); |
|
135 | - Util::connectHook( |
|
136 | - Filesystem::CLASSNAME, |
|
137 | - Filesystem::signal_post_create, |
|
138 | - $fileActions, |
|
139 | - 'create' |
|
140 | - ); |
|
141 | - Util::connectHook( |
|
142 | - Filesystem::CLASSNAME, |
|
143 | - Filesystem::signal_post_copy, |
|
144 | - $fileActions, |
|
145 | - 'copy' |
|
146 | - ); |
|
147 | - Util::connectHook( |
|
148 | - Filesystem::CLASSNAME, |
|
149 | - Filesystem::signal_post_write, |
|
150 | - $fileActions, |
|
151 | - 'write' |
|
152 | - ); |
|
153 | - Util::connectHook( |
|
154 | - Filesystem::CLASSNAME, |
|
155 | - Filesystem::signal_post_update, |
|
156 | - $fileActions, |
|
157 | - 'update' |
|
158 | - ); |
|
159 | - Util::connectHook( |
|
160 | - Filesystem::CLASSNAME, |
|
161 | - Filesystem::signal_read, |
|
162 | - $fileActions, |
|
163 | - 'read' |
|
164 | - ); |
|
165 | - Util::connectHook( |
|
166 | - Filesystem::CLASSNAME, |
|
167 | - Filesystem::signal_delete, |
|
168 | - $fileActions, |
|
169 | - 'delete' |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - public function versionsHooks() { |
|
174 | - $versionsActions = new Versions($this->logger); |
|
175 | - Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
176 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * connect to trash bin hooks |
|
181 | - */ |
|
182 | - private function trashbinHooks() { |
|
183 | - $trashActions = new Trashbin($this->logger); |
|
184 | - Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
185 | - Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
186 | - } |
|
91 | + private function groupHooks() { |
|
92 | + $groupActions = new GroupManagement($this->logger); |
|
93 | + $this->groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
94 | + $this->groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * connect to sharing events |
|
99 | + */ |
|
100 | + private function sharingHooks() { |
|
101 | + $shareActions = new Sharing($this->logger); |
|
102 | + |
|
103 | + Util::connectHook('OCP\Share', 'post_shared', $shareActions, 'shared'); |
|
104 | + Util::connectHook('OCP\Share', 'post_unshare', $shareActions, 'unshare'); |
|
105 | + Util::connectHook('OCP\Share', 'post_update_permissions', $shareActions, 'updatePermissions'); |
|
106 | + Util::connectHook('OCP\Share', 'post_update_password', $shareActions, 'updatePassword'); |
|
107 | + Util::connectHook('OCP\Share', 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); |
|
108 | + Util::connectHook('OCP\Share', 'share_link_access', $shareActions, 'shareAccessed'); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * connect to authentication event and related actions |
|
113 | + */ |
|
114 | + private function authHooks() { |
|
115 | + $authActions = new Auth($this->logger); |
|
116 | + |
|
117 | + Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
118 | + Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
119 | + Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * connect to file hooks |
|
125 | + */ |
|
126 | + private function fileHooks() { |
|
127 | + $fileActions = new Files($this->logger); |
|
128 | + |
|
129 | + Util::connectHook( |
|
130 | + Filesystem::CLASSNAME, |
|
131 | + Filesystem::signal_post_rename, |
|
132 | + $fileActions, |
|
133 | + 'rename' |
|
134 | + ); |
|
135 | + Util::connectHook( |
|
136 | + Filesystem::CLASSNAME, |
|
137 | + Filesystem::signal_post_create, |
|
138 | + $fileActions, |
|
139 | + 'create' |
|
140 | + ); |
|
141 | + Util::connectHook( |
|
142 | + Filesystem::CLASSNAME, |
|
143 | + Filesystem::signal_post_copy, |
|
144 | + $fileActions, |
|
145 | + 'copy' |
|
146 | + ); |
|
147 | + Util::connectHook( |
|
148 | + Filesystem::CLASSNAME, |
|
149 | + Filesystem::signal_post_write, |
|
150 | + $fileActions, |
|
151 | + 'write' |
|
152 | + ); |
|
153 | + Util::connectHook( |
|
154 | + Filesystem::CLASSNAME, |
|
155 | + Filesystem::signal_post_update, |
|
156 | + $fileActions, |
|
157 | + 'update' |
|
158 | + ); |
|
159 | + Util::connectHook( |
|
160 | + Filesystem::CLASSNAME, |
|
161 | + Filesystem::signal_read, |
|
162 | + $fileActions, |
|
163 | + 'read' |
|
164 | + ); |
|
165 | + Util::connectHook( |
|
166 | + Filesystem::CLASSNAME, |
|
167 | + Filesystem::signal_delete, |
|
168 | + $fileActions, |
|
169 | + 'delete' |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + public function versionsHooks() { |
|
174 | + $versionsActions = new Versions($this->logger); |
|
175 | + Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
176 | + Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * connect to trash bin hooks |
|
181 | + */ |
|
182 | + private function trashbinHooks() { |
|
183 | + $trashActions = new Trashbin($this->logger); |
|
184 | + Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
185 | + Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
186 | + } |
|
187 | 187 | |
188 | 188 | } |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | private function userManagementHooks() { |
84 | 84 | $userActions = new UserManagement($this->logger); |
85 | 85 | |
86 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
87 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
86 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
87 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
88 | 88 | $this->userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
89 | 89 | } |
90 | 90 | |
91 | - private function groupHooks() { |
|
91 | + private function groupHooks() { |
|
92 | 92 | $groupActions = new GroupManagement($this->logger); |
93 | - $this->groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
94 | - $this->groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
93 | + $this->groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
94 | + $this->groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function versionsHooks() { |
174 | 174 | $versionsActions = new Versions($this->logger); |
175 | 175 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
176 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
176 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -37,40 +37,40 @@ |
||
37 | 37 | */ |
38 | 38 | class GroupManagement extends Action { |
39 | 39 | |
40 | - /** |
|
41 | - * log add user to group event |
|
42 | - * |
|
43 | - * @param IGroup $group |
|
44 | - * @param IUser $user |
|
45 | - */ |
|
46 | - public function addUser(IGroup $group, IUser $user) { |
|
47 | - $this->log('User "%s" added to group "%s"', |
|
48 | - [ |
|
49 | - 'group' => $group->getGID(), |
|
50 | - 'user' => $user->getUID() |
|
51 | - ], |
|
52 | - [ |
|
53 | - 'user', 'group' |
|
54 | - ] |
|
55 | - ); |
|
56 | - } |
|
40 | + /** |
|
41 | + * log add user to group event |
|
42 | + * |
|
43 | + * @param IGroup $group |
|
44 | + * @param IUser $user |
|
45 | + */ |
|
46 | + public function addUser(IGroup $group, IUser $user) { |
|
47 | + $this->log('User "%s" added to group "%s"', |
|
48 | + [ |
|
49 | + 'group' => $group->getGID(), |
|
50 | + 'user' => $user->getUID() |
|
51 | + ], |
|
52 | + [ |
|
53 | + 'user', 'group' |
|
54 | + ] |
|
55 | + ); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * log remove user from group event |
|
60 | - * |
|
61 | - * @param IGroup $group |
|
62 | - * @param IUser $user |
|
63 | - */ |
|
64 | - public function removeUser(IGroup $group, IUser $user) { |
|
65 | - $this->log('User "%s" removed from group "%s"', |
|
66 | - [ |
|
67 | - 'group' => $group->getGID(), |
|
68 | - 'user' => $user->getUID() |
|
69 | - ], |
|
70 | - [ |
|
71 | - 'user', 'group' |
|
72 | - ] |
|
73 | - ); |
|
74 | - } |
|
58 | + /** |
|
59 | + * log remove user from group event |
|
60 | + * |
|
61 | + * @param IGroup $group |
|
62 | + * @param IUser $user |
|
63 | + */ |
|
64 | + public function removeUser(IGroup $group, IUser $user) { |
|
65 | + $this->log('User "%s" removed from group "%s"', |
|
66 | + [ |
|
67 | + 'group' => $group->getGID(), |
|
68 | + 'user' => $user->getUID() |
|
69 | + ], |
|
70 | + [ |
|
71 | + 'user', 'group' |
|
72 | + ] |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
@@ -30,52 +30,52 @@ |
||
30 | 30 | * @package OCA\Admin_Audit\Actions |
31 | 31 | */ |
32 | 32 | class UserManagement extends Action { |
33 | - /** |
|
34 | - * Log creation of users |
|
35 | - * |
|
36 | - * @param array $params |
|
37 | - */ |
|
38 | - public function create(array $params) { |
|
39 | - $this->log( |
|
40 | - 'User created: "%s"', |
|
41 | - $params, |
|
42 | - [ |
|
43 | - 'uid', |
|
44 | - ] |
|
45 | - ); |
|
46 | - } |
|
33 | + /** |
|
34 | + * Log creation of users |
|
35 | + * |
|
36 | + * @param array $params |
|
37 | + */ |
|
38 | + public function create(array $params) { |
|
39 | + $this->log( |
|
40 | + 'User created: "%s"', |
|
41 | + $params, |
|
42 | + [ |
|
43 | + 'uid', |
|
44 | + ] |
|
45 | + ); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Log deletion of users |
|
50 | - * |
|
51 | - * @param array $params |
|
52 | - */ |
|
53 | - public function delete(array $params) { |
|
54 | - $this->log( |
|
55 | - 'User deleted: "%s"', |
|
56 | - $params, |
|
57 | - [ |
|
58 | - 'uid', |
|
59 | - ] |
|
60 | - ); |
|
61 | - } |
|
48 | + /** |
|
49 | + * Log deletion of users |
|
50 | + * |
|
51 | + * @param array $params |
|
52 | + */ |
|
53 | + public function delete(array $params) { |
|
54 | + $this->log( |
|
55 | + 'User deleted: "%s"', |
|
56 | + $params, |
|
57 | + [ |
|
58 | + 'uid', |
|
59 | + ] |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Logs changing of the user scope |
|
65 | - * |
|
66 | - * @param IUser $user |
|
67 | - */ |
|
68 | - public function setPassword(IUser $user) { |
|
69 | - if($user->getBackendClassName() === 'Database') { |
|
70 | - $this->log( |
|
71 | - 'Password of user "%s" has been changed', |
|
72 | - [ |
|
73 | - 'user' => $user->getUID(), |
|
74 | - ], |
|
75 | - [ |
|
76 | - 'user', |
|
77 | - ] |
|
78 | - ); |
|
79 | - } |
|
80 | - } |
|
63 | + /** |
|
64 | + * Logs changing of the user scope |
|
65 | + * |
|
66 | + * @param IUser $user |
|
67 | + */ |
|
68 | + public function setPassword(IUser $user) { |
|
69 | + if($user->getBackendClassName() === 'Database') { |
|
70 | + $this->log( |
|
71 | + 'Password of user "%s" has been changed', |
|
72 | + [ |
|
73 | + 'user' => $user->getUID(), |
|
74 | + ], |
|
75 | + [ |
|
76 | + 'user', |
|
77 | + ] |
|
78 | + ); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | * @param IUser $user |
67 | 67 | */ |
68 | 68 | public function setPassword(IUser $user) { |
69 | - if($user->getBackendClassName() === 'Database') { |
|
69 | + if ($user->getBackendClassName() === 'Database') { |
|
70 | 70 | $this->log( |
71 | 71 | 'Password of user "%s" has been changed', |
72 | 72 | [ |
@@ -28,110 +28,110 @@ |
||
28 | 28 | * @package OCA\Admin_Audit\Actions |
29 | 29 | */ |
30 | 30 | class Files extends Action { |
31 | - /** |
|
32 | - * Logs file read actions |
|
33 | - * |
|
34 | - * @param array $params |
|
35 | - */ |
|
36 | - public function read(array $params) { |
|
37 | - $this->log( |
|
38 | - 'File accessed: "%s"', |
|
39 | - $params, |
|
40 | - [ |
|
41 | - 'path', |
|
42 | - ] |
|
43 | - ); |
|
44 | - } |
|
31 | + /** |
|
32 | + * Logs file read actions |
|
33 | + * |
|
34 | + * @param array $params |
|
35 | + */ |
|
36 | + public function read(array $params) { |
|
37 | + $this->log( |
|
38 | + 'File accessed: "%s"', |
|
39 | + $params, |
|
40 | + [ |
|
41 | + 'path', |
|
42 | + ] |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Logs rename actions of files |
|
48 | - * |
|
49 | - * @param array $params |
|
50 | - */ |
|
51 | - public function rename(array $params) { |
|
52 | - $this->log( |
|
53 | - 'File renamed: "%s" to "%s"', |
|
54 | - $params, |
|
55 | - [ |
|
56 | - 'oldpath', |
|
57 | - 'newpath', |
|
58 | - ] |
|
59 | - ); |
|
60 | - } |
|
46 | + /** |
|
47 | + * Logs rename actions of files |
|
48 | + * |
|
49 | + * @param array $params |
|
50 | + */ |
|
51 | + public function rename(array $params) { |
|
52 | + $this->log( |
|
53 | + 'File renamed: "%s" to "%s"', |
|
54 | + $params, |
|
55 | + [ |
|
56 | + 'oldpath', |
|
57 | + 'newpath', |
|
58 | + ] |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Logs creation of files |
|
64 | - * |
|
65 | - * @param array $params |
|
66 | - */ |
|
67 | - public function create(array $params) { |
|
68 | - $this->log( |
|
69 | - 'File created: "%s"', |
|
70 | - $params, |
|
71 | - [ |
|
72 | - 'path', |
|
73 | - ] |
|
74 | - ); |
|
75 | - } |
|
62 | + /** |
|
63 | + * Logs creation of files |
|
64 | + * |
|
65 | + * @param array $params |
|
66 | + */ |
|
67 | + public function create(array $params) { |
|
68 | + $this->log( |
|
69 | + 'File created: "%s"', |
|
70 | + $params, |
|
71 | + [ |
|
72 | + 'path', |
|
73 | + ] |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Logs copying of files |
|
79 | - * |
|
80 | - * @param array $params |
|
81 | - */ |
|
82 | - public function copy(array $params) { |
|
83 | - $this->log( |
|
84 | - 'File copied: "%s" to "%s"', |
|
85 | - $params, |
|
86 | - [ |
|
87 | - 'oldpath', |
|
88 | - 'newpath', |
|
89 | - ] |
|
90 | - ); |
|
91 | - } |
|
77 | + /** |
|
78 | + * Logs copying of files |
|
79 | + * |
|
80 | + * @param array $params |
|
81 | + */ |
|
82 | + public function copy(array $params) { |
|
83 | + $this->log( |
|
84 | + 'File copied: "%s" to "%s"', |
|
85 | + $params, |
|
86 | + [ |
|
87 | + 'oldpath', |
|
88 | + 'newpath', |
|
89 | + ] |
|
90 | + ); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Logs writing of files |
|
95 | - * |
|
96 | - * @param array $params |
|
97 | - */ |
|
98 | - public function write(array $params) { |
|
99 | - $this->log( |
|
100 | - 'File written to: "%s"', |
|
101 | - $params, |
|
102 | - [ |
|
103 | - 'path', |
|
104 | - ] |
|
105 | - ); |
|
106 | - } |
|
93 | + /** |
|
94 | + * Logs writing of files |
|
95 | + * |
|
96 | + * @param array $params |
|
97 | + */ |
|
98 | + public function write(array $params) { |
|
99 | + $this->log( |
|
100 | + 'File written to: "%s"', |
|
101 | + $params, |
|
102 | + [ |
|
103 | + 'path', |
|
104 | + ] |
|
105 | + ); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Logs update of files |
|
110 | - * |
|
111 | - * @param array $params |
|
112 | - */ |
|
113 | - public function update(array $params) { |
|
114 | - $this->log( |
|
115 | - 'File updated: "%s"', |
|
116 | - $params, |
|
117 | - [ |
|
118 | - 'path', |
|
119 | - ] |
|
120 | - ); |
|
121 | - } |
|
108 | + /** |
|
109 | + * Logs update of files |
|
110 | + * |
|
111 | + * @param array $params |
|
112 | + */ |
|
113 | + public function update(array $params) { |
|
114 | + $this->log( |
|
115 | + 'File updated: "%s"', |
|
116 | + $params, |
|
117 | + [ |
|
118 | + 'path', |
|
119 | + ] |
|
120 | + ); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Logs deletions of files |
|
125 | - * |
|
126 | - * @param array $params |
|
127 | - */ |
|
128 | - public function delete(array $params) { |
|
129 | - $this->log( |
|
130 | - 'File deleted: "%s"', |
|
131 | - $params, |
|
132 | - [ |
|
133 | - 'path', |
|
134 | - ] |
|
135 | - ); |
|
136 | - } |
|
123 | + /** |
|
124 | + * Logs deletions of files |
|
125 | + * |
|
126 | + * @param array $params |
|
127 | + */ |
|
128 | + public function delete(array $params) { |
|
129 | + $this->log( |
|
130 | + 'File deleted: "%s"', |
|
131 | + $params, |
|
132 | + [ |
|
133 | + 'path', |
|
134 | + ] |
|
135 | + ); |
|
136 | + } |
|
137 | 137 | } |