@@ -46,173 +46,173 @@ |
||
| 46 | 46 | |
| 47 | 47 | class Application extends App { |
| 48 | 48 | |
| 49 | - public function __construct() { |
|
| 50 | - parent::__construct('admin_audit'); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function register() { |
|
| 54 | - $this->registerHooks(); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Register hooks in order to log them |
|
| 59 | - */ |
|
| 60 | - protected function registerHooks() { |
|
| 61 | - $logger = $this->getContainer()->getServer()->getLogger(); |
|
| 62 | - |
|
| 63 | - $this->userManagementHooks($logger); |
|
| 64 | - $this->groupHooks($logger); |
|
| 65 | - $this->authHooks($logger); |
|
| 66 | - |
|
| 67 | - $this->consoleHooks($logger); |
|
| 68 | - $this->appHooks($logger); |
|
| 69 | - |
|
| 70 | - $this->sharingHooks($logger); |
|
| 71 | - |
|
| 72 | - $this->fileHooks($logger); |
|
| 73 | - $this->trashbinHooks($logger); |
|
| 74 | - $this->versionsHooks($logger); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - protected function userManagementHooks(ILogger $logger) { |
|
| 78 | - $userActions = new UserManagement($logger); |
|
| 79 | - |
|
| 80 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 81 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 82 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 83 | - |
|
| 84 | - /** @var IUserSession|Session $userSession */ |
|
| 85 | - $userSession = $this->getContainer()->getServer()->getUserSession(); |
|
| 86 | - $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - protected function groupHooks(ILogger $logger) { |
|
| 90 | - $groupActions = new GroupManagement($logger); |
|
| 91 | - |
|
| 92 | - /** @var IGroupManager|Manager $groupManager */ |
|
| 93 | - $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
|
| 94 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 95 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 96 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 97 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - protected function sharingHooks(ILogger $logger) { |
|
| 101 | - $shareActions = new Sharing($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 | - protected function authHooks(ILogger $logger) { |
|
| 112 | - $authActions = new Auth($logger); |
|
| 113 | - |
|
| 114 | - Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
| 115 | - Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
| 116 | - Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - protected function appHooks(ILogger $logger) { |
|
| 120 | - |
|
| 121 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 122 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) use ($logger) { |
|
| 123 | - $appActions = new AppManagement($logger); |
|
| 124 | - $appActions->enableApp($event->getAppID()); |
|
| 125 | - }); |
|
| 126 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) use ($logger) { |
|
| 127 | - $appActions = new AppManagement($logger); |
|
| 128 | - $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); |
|
| 129 | - }); |
|
| 130 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) use ($logger) { |
|
| 131 | - $appActions = new AppManagement($logger); |
|
| 132 | - $appActions->disableApp($event->getAppID()); |
|
| 133 | - }); |
|
| 134 | - |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - protected function consoleHooks(ILogger $logger) { |
|
| 138 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 139 | - $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) use ($logger) { |
|
| 140 | - $appActions = new Console($logger); |
|
| 141 | - $appActions->runCommand($event->getArguments()); |
|
| 142 | - }); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - protected function fileHooks(ILogger $logger) { |
|
| 146 | - $fileActions = new Files($logger); |
|
| 147 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 148 | - $eventDispatcher->addListener( |
|
| 149 | - IPreview::EVENT, |
|
| 150 | - function(GenericEvent $event) use ($fileActions) { |
|
| 151 | - /** @var File $file */ |
|
| 152 | - $file = $event->getSubject(); |
|
| 153 | - $fileActions->preview([ |
|
| 154 | - 'path' => substr($file->getInternalPath(), 5), |
|
| 155 | - 'width' => $event->getArguments()['width'], |
|
| 156 | - 'height' => $event->getArguments()['height'], |
|
| 157 | - 'crop' => $event->getArguments()['crop'], |
|
| 158 | - 'mode' => $event->getArguments()['mode'] |
|
| 159 | - ]); |
|
| 160 | - } |
|
| 161 | - ); |
|
| 162 | - |
|
| 163 | - Util::connectHook( |
|
| 164 | - Filesystem::CLASSNAME, |
|
| 165 | - Filesystem::signal_post_rename, |
|
| 166 | - $fileActions, |
|
| 167 | - 'rename' |
|
| 168 | - ); |
|
| 169 | - Util::connectHook( |
|
| 170 | - Filesystem::CLASSNAME, |
|
| 171 | - Filesystem::signal_post_create, |
|
| 172 | - $fileActions, |
|
| 173 | - 'create' |
|
| 174 | - ); |
|
| 175 | - Util::connectHook( |
|
| 176 | - Filesystem::CLASSNAME, |
|
| 177 | - Filesystem::signal_post_copy, |
|
| 178 | - $fileActions, |
|
| 179 | - 'copy' |
|
| 180 | - ); |
|
| 181 | - Util::connectHook( |
|
| 182 | - Filesystem::CLASSNAME, |
|
| 183 | - Filesystem::signal_post_write, |
|
| 184 | - $fileActions, |
|
| 185 | - 'write' |
|
| 186 | - ); |
|
| 187 | - Util::connectHook( |
|
| 188 | - Filesystem::CLASSNAME, |
|
| 189 | - Filesystem::signal_post_update, |
|
| 190 | - $fileActions, |
|
| 191 | - 'update' |
|
| 192 | - ); |
|
| 193 | - Util::connectHook( |
|
| 194 | - Filesystem::CLASSNAME, |
|
| 195 | - Filesystem::signal_read, |
|
| 196 | - $fileActions, |
|
| 197 | - 'read' |
|
| 198 | - ); |
|
| 199 | - Util::connectHook( |
|
| 200 | - Filesystem::CLASSNAME, |
|
| 201 | - Filesystem::signal_delete, |
|
| 202 | - $fileActions, |
|
| 203 | - 'delete' |
|
| 204 | - ); |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - protected function versionsHooks(ILogger $logger) { |
|
| 208 | - $versionsActions = new Versions($logger); |
|
| 209 | - Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
| 210 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - protected function trashbinHooks(ILogger $logger) { |
|
| 214 | - $trashActions = new Trashbin($logger); |
|
| 215 | - Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
| 216 | - Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
| 217 | - } |
|
| 49 | + public function __construct() { |
|
| 50 | + parent::__construct('admin_audit'); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function register() { |
|
| 54 | + $this->registerHooks(); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Register hooks in order to log them |
|
| 59 | + */ |
|
| 60 | + protected function registerHooks() { |
|
| 61 | + $logger = $this->getContainer()->getServer()->getLogger(); |
|
| 62 | + |
|
| 63 | + $this->userManagementHooks($logger); |
|
| 64 | + $this->groupHooks($logger); |
|
| 65 | + $this->authHooks($logger); |
|
| 66 | + |
|
| 67 | + $this->consoleHooks($logger); |
|
| 68 | + $this->appHooks($logger); |
|
| 69 | + |
|
| 70 | + $this->sharingHooks($logger); |
|
| 71 | + |
|
| 72 | + $this->fileHooks($logger); |
|
| 73 | + $this->trashbinHooks($logger); |
|
| 74 | + $this->versionsHooks($logger); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + protected function userManagementHooks(ILogger $logger) { |
|
| 78 | + $userActions = new UserManagement($logger); |
|
| 79 | + |
|
| 80 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 81 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 82 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 83 | + |
|
| 84 | + /** @var IUserSession|Session $userSession */ |
|
| 85 | + $userSession = $this->getContainer()->getServer()->getUserSession(); |
|
| 86 | + $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + protected function groupHooks(ILogger $logger) { |
|
| 90 | + $groupActions = new GroupManagement($logger); |
|
| 91 | + |
|
| 92 | + /** @var IGroupManager|Manager $groupManager */ |
|
| 93 | + $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
|
| 94 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 95 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 96 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 97 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + protected function sharingHooks(ILogger $logger) { |
|
| 101 | + $shareActions = new Sharing($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 | + protected function authHooks(ILogger $logger) { |
|
| 112 | + $authActions = new Auth($logger); |
|
| 113 | + |
|
| 114 | + Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
| 115 | + Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
| 116 | + Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + protected function appHooks(ILogger $logger) { |
|
| 120 | + |
|
| 121 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 122 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) use ($logger) { |
|
| 123 | + $appActions = new AppManagement($logger); |
|
| 124 | + $appActions->enableApp($event->getAppID()); |
|
| 125 | + }); |
|
| 126 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) use ($logger) { |
|
| 127 | + $appActions = new AppManagement($logger); |
|
| 128 | + $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); |
|
| 129 | + }); |
|
| 130 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) use ($logger) { |
|
| 131 | + $appActions = new AppManagement($logger); |
|
| 132 | + $appActions->disableApp($event->getAppID()); |
|
| 133 | + }); |
|
| 134 | + |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + protected function consoleHooks(ILogger $logger) { |
|
| 138 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 139 | + $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) use ($logger) { |
|
| 140 | + $appActions = new Console($logger); |
|
| 141 | + $appActions->runCommand($event->getArguments()); |
|
| 142 | + }); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + protected function fileHooks(ILogger $logger) { |
|
| 146 | + $fileActions = new Files($logger); |
|
| 147 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 148 | + $eventDispatcher->addListener( |
|
| 149 | + IPreview::EVENT, |
|
| 150 | + function(GenericEvent $event) use ($fileActions) { |
|
| 151 | + /** @var File $file */ |
|
| 152 | + $file = $event->getSubject(); |
|
| 153 | + $fileActions->preview([ |
|
| 154 | + 'path' => substr($file->getInternalPath(), 5), |
|
| 155 | + 'width' => $event->getArguments()['width'], |
|
| 156 | + 'height' => $event->getArguments()['height'], |
|
| 157 | + 'crop' => $event->getArguments()['crop'], |
|
| 158 | + 'mode' => $event->getArguments()['mode'] |
|
| 159 | + ]); |
|
| 160 | + } |
|
| 161 | + ); |
|
| 162 | + |
|
| 163 | + Util::connectHook( |
|
| 164 | + Filesystem::CLASSNAME, |
|
| 165 | + Filesystem::signal_post_rename, |
|
| 166 | + $fileActions, |
|
| 167 | + 'rename' |
|
| 168 | + ); |
|
| 169 | + Util::connectHook( |
|
| 170 | + Filesystem::CLASSNAME, |
|
| 171 | + Filesystem::signal_post_create, |
|
| 172 | + $fileActions, |
|
| 173 | + 'create' |
|
| 174 | + ); |
|
| 175 | + Util::connectHook( |
|
| 176 | + Filesystem::CLASSNAME, |
|
| 177 | + Filesystem::signal_post_copy, |
|
| 178 | + $fileActions, |
|
| 179 | + 'copy' |
|
| 180 | + ); |
|
| 181 | + Util::connectHook( |
|
| 182 | + Filesystem::CLASSNAME, |
|
| 183 | + Filesystem::signal_post_write, |
|
| 184 | + $fileActions, |
|
| 185 | + 'write' |
|
| 186 | + ); |
|
| 187 | + Util::connectHook( |
|
| 188 | + Filesystem::CLASSNAME, |
|
| 189 | + Filesystem::signal_post_update, |
|
| 190 | + $fileActions, |
|
| 191 | + 'update' |
|
| 192 | + ); |
|
| 193 | + Util::connectHook( |
|
| 194 | + Filesystem::CLASSNAME, |
|
| 195 | + Filesystem::signal_read, |
|
| 196 | + $fileActions, |
|
| 197 | + 'read' |
|
| 198 | + ); |
|
| 199 | + Util::connectHook( |
|
| 200 | + Filesystem::CLASSNAME, |
|
| 201 | + Filesystem::signal_delete, |
|
| 202 | + $fileActions, |
|
| 203 | + 'delete' |
|
| 204 | + ); |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + protected function versionsHooks(ILogger $logger) { |
|
| 208 | + $versionsActions = new Versions($logger); |
|
| 209 | + Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
| 210 | + Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + protected function trashbinHooks(ILogger $logger) { |
|
| 214 | + $trashActions = new Trashbin($logger); |
|
| 215 | + Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
| 216 | + Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
| 217 | + } |
|
| 218 | 218 | } |
@@ -77,24 +77,24 @@ discard block |
||
| 77 | 77 | protected function userManagementHooks(ILogger $logger) { |
| 78 | 78 | $userActions = new UserManagement($logger); |
| 79 | 79 | |
| 80 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 81 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 82 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 80 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 81 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 82 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 83 | 83 | |
| 84 | 84 | /** @var IUserSession|Session $userSession */ |
| 85 | 85 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
| 86 | 86 | $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - protected function groupHooks(ILogger $logger) { |
|
| 89 | + protected function groupHooks(ILogger $logger) { |
|
| 90 | 90 | $groupActions = new GroupManagement($logger); |
| 91 | 91 | |
| 92 | 92 | /** @var IGroupManager|Manager $groupManager */ |
| 93 | 93 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
| 94 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 95 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 96 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 97 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 94 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 95 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 96 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 97 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | protected function sharingHooks(ILogger $logger) { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | protected function versionsHooks(ILogger $logger) { |
| 208 | 208 | $versionsActions = new Versions($logger); |
| 209 | 209 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
| 210 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 210 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | protected function trashbinHooks(ILogger $logger) { |
@@ -32,163 +32,163 @@ |
||
| 32 | 32 | * @package OCA\AdminAudit\Actions |
| 33 | 33 | */ |
| 34 | 34 | class Sharing extends Action { |
| 35 | - /** |
|
| 36 | - * Logs sharing of data |
|
| 37 | - * |
|
| 38 | - * @param array $params |
|
| 39 | - */ |
|
| 40 | - public function shared(array $params) { |
|
| 41 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
| 42 | - $this->log( |
|
| 43 | - 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
|
| 44 | - $params, |
|
| 45 | - [ |
|
| 46 | - 'itemType', |
|
| 47 | - 'itemTarget', |
|
| 48 | - 'itemSource', |
|
| 49 | - 'permissions', |
|
| 50 | - 'id', |
|
| 51 | - ] |
|
| 52 | - ); |
|
| 53 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
| 54 | - $this->log( |
|
| 55 | - 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
|
| 56 | - $params, |
|
| 57 | - [ |
|
| 58 | - 'itemType', |
|
| 59 | - 'itemTarget', |
|
| 60 | - 'itemSource', |
|
| 61 | - 'shareWith', |
|
| 62 | - 'permissions', |
|
| 63 | - 'id', |
|
| 64 | - ] |
|
| 65 | - ); |
|
| 66 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
| 67 | - $this->log( |
|
| 68 | - 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
|
| 69 | - $params, |
|
| 70 | - [ |
|
| 71 | - 'itemType', |
|
| 72 | - 'itemTarget', |
|
| 73 | - 'itemSource', |
|
| 74 | - 'shareWith', |
|
| 75 | - 'permissions', |
|
| 76 | - 'id', |
|
| 77 | - ] |
|
| 78 | - ); |
|
| 79 | - } |
|
| 80 | - } |
|
| 35 | + /** |
|
| 36 | + * Logs sharing of data |
|
| 37 | + * |
|
| 38 | + * @param array $params |
|
| 39 | + */ |
|
| 40 | + public function shared(array $params) { |
|
| 41 | + if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
| 42 | + $this->log( |
|
| 43 | + 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
|
| 44 | + $params, |
|
| 45 | + [ |
|
| 46 | + 'itemType', |
|
| 47 | + 'itemTarget', |
|
| 48 | + 'itemSource', |
|
| 49 | + 'permissions', |
|
| 50 | + 'id', |
|
| 51 | + ] |
|
| 52 | + ); |
|
| 53 | + } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
| 54 | + $this->log( |
|
| 55 | + 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
|
| 56 | + $params, |
|
| 57 | + [ |
|
| 58 | + 'itemType', |
|
| 59 | + 'itemTarget', |
|
| 60 | + 'itemSource', |
|
| 61 | + 'shareWith', |
|
| 62 | + 'permissions', |
|
| 63 | + 'id', |
|
| 64 | + ] |
|
| 65 | + ); |
|
| 66 | + } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
| 67 | + $this->log( |
|
| 68 | + 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
|
| 69 | + $params, |
|
| 70 | + [ |
|
| 71 | + 'itemType', |
|
| 72 | + 'itemTarget', |
|
| 73 | + 'itemSource', |
|
| 74 | + 'shareWith', |
|
| 75 | + 'permissions', |
|
| 76 | + 'id', |
|
| 77 | + ] |
|
| 78 | + ); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Logs unsharing of data |
|
| 84 | - * |
|
| 85 | - * @param array $params |
|
| 86 | - */ |
|
| 87 | - public function unshare(array $params) { |
|
| 88 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
| 89 | - $this->log( |
|
| 90 | - 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
|
| 91 | - $params, |
|
| 92 | - [ |
|
| 93 | - 'itemType', |
|
| 94 | - 'fileTarget', |
|
| 95 | - 'itemSource', |
|
| 96 | - 'id', |
|
| 97 | - ] |
|
| 98 | - ); |
|
| 99 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
| 100 | - $this->log( |
|
| 101 | - 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
|
| 102 | - $params, |
|
| 103 | - [ |
|
| 104 | - 'itemType', |
|
| 105 | - 'fileTarget', |
|
| 106 | - 'itemSource', |
|
| 107 | - 'shareWith', |
|
| 108 | - 'id', |
|
| 109 | - ] |
|
| 110 | - ); |
|
| 111 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
| 112 | - $this->log( |
|
| 113 | - 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
|
| 114 | - $params, |
|
| 115 | - [ |
|
| 116 | - 'itemType', |
|
| 117 | - 'fileTarget', |
|
| 118 | - 'itemSource', |
|
| 119 | - 'shareWith', |
|
| 120 | - 'id', |
|
| 121 | - ] |
|
| 122 | - ); |
|
| 123 | - } |
|
| 124 | - } |
|
| 82 | + /** |
|
| 83 | + * Logs unsharing of data |
|
| 84 | + * |
|
| 85 | + * @param array $params |
|
| 86 | + */ |
|
| 87 | + public function unshare(array $params) { |
|
| 88 | + if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
| 89 | + $this->log( |
|
| 90 | + 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
|
| 91 | + $params, |
|
| 92 | + [ |
|
| 93 | + 'itemType', |
|
| 94 | + 'fileTarget', |
|
| 95 | + 'itemSource', |
|
| 96 | + 'id', |
|
| 97 | + ] |
|
| 98 | + ); |
|
| 99 | + } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
| 100 | + $this->log( |
|
| 101 | + 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
|
| 102 | + $params, |
|
| 103 | + [ |
|
| 104 | + 'itemType', |
|
| 105 | + 'fileTarget', |
|
| 106 | + 'itemSource', |
|
| 107 | + 'shareWith', |
|
| 108 | + 'id', |
|
| 109 | + ] |
|
| 110 | + ); |
|
| 111 | + } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
| 112 | + $this->log( |
|
| 113 | + 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
|
| 114 | + $params, |
|
| 115 | + [ |
|
| 116 | + 'itemType', |
|
| 117 | + 'fileTarget', |
|
| 118 | + 'itemSource', |
|
| 119 | + 'shareWith', |
|
| 120 | + 'id', |
|
| 121 | + ] |
|
| 122 | + ); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Logs the updating of permission changes for shares |
|
| 128 | - * |
|
| 129 | - * @param array $params |
|
| 130 | - */ |
|
| 131 | - public function updatePermissions(array $params) { |
|
| 132 | - $this->log( |
|
| 133 | - 'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"', |
|
| 134 | - $params, |
|
| 135 | - [ |
|
| 136 | - 'itemType', |
|
| 137 | - 'path', |
|
| 138 | - 'itemSource', |
|
| 139 | - 'permissions', |
|
| 140 | - ] |
|
| 141 | - ); |
|
| 142 | - } |
|
| 126 | + /** |
|
| 127 | + * Logs the updating of permission changes for shares |
|
| 128 | + * |
|
| 129 | + * @param array $params |
|
| 130 | + */ |
|
| 131 | + public function updatePermissions(array $params) { |
|
| 132 | + $this->log( |
|
| 133 | + 'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"', |
|
| 134 | + $params, |
|
| 135 | + [ |
|
| 136 | + 'itemType', |
|
| 137 | + 'path', |
|
| 138 | + 'itemSource', |
|
| 139 | + 'permissions', |
|
| 140 | + ] |
|
| 141 | + ); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Logs the password changes for a share |
|
| 146 | - * |
|
| 147 | - * @param array $params |
|
| 148 | - */ |
|
| 149 | - public function updatePassword(array $params) { |
|
| 150 | - $this->log( |
|
| 151 | - 'The password of the publicly shared %s "%s" with ID "%s" has been changed', |
|
| 152 | - $params, |
|
| 153 | - [ |
|
| 154 | - 'itemType', |
|
| 155 | - 'token', |
|
| 156 | - 'itemSource', |
|
| 157 | - ] |
|
| 158 | - ); |
|
| 159 | - } |
|
| 144 | + /** |
|
| 145 | + * Logs the password changes for a share |
|
| 146 | + * |
|
| 147 | + * @param array $params |
|
| 148 | + */ |
|
| 149 | + public function updatePassword(array $params) { |
|
| 150 | + $this->log( |
|
| 151 | + 'The password of the publicly shared %s "%s" with ID "%s" has been changed', |
|
| 152 | + $params, |
|
| 153 | + [ |
|
| 154 | + 'itemType', |
|
| 155 | + 'token', |
|
| 156 | + 'itemSource', |
|
| 157 | + ] |
|
| 158 | + ); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Logs the expiration date changes for a share |
|
| 163 | - * |
|
| 164 | - * @param array $params |
|
| 165 | - */ |
|
| 166 | - public function updateExpirationDate(array $params) { |
|
| 167 | - $this->log( |
|
| 168 | - 'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"', |
|
| 169 | - $params, |
|
| 170 | - [ |
|
| 171 | - 'itemType', |
|
| 172 | - 'itemSource', |
|
| 173 | - 'date', |
|
| 174 | - ] |
|
| 175 | - ); |
|
| 176 | - } |
|
| 161 | + /** |
|
| 162 | + * Logs the expiration date changes for a share |
|
| 163 | + * |
|
| 164 | + * @param array $params |
|
| 165 | + */ |
|
| 166 | + public function updateExpirationDate(array $params) { |
|
| 167 | + $this->log( |
|
| 168 | + 'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"', |
|
| 169 | + $params, |
|
| 170 | + [ |
|
| 171 | + 'itemType', |
|
| 172 | + 'itemSource', |
|
| 173 | + 'date', |
|
| 174 | + ] |
|
| 175 | + ); |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Logs access of shared files |
|
| 180 | - * |
|
| 181 | - * @param array $params |
|
| 182 | - */ |
|
| 183 | - public function shareAccessed(array $params) { |
|
| 184 | - $this->log( |
|
| 185 | - 'The shared %s with the token "%s" by "%s" has been accessed.', |
|
| 186 | - $params, |
|
| 187 | - [ |
|
| 188 | - 'itemType', |
|
| 189 | - 'token', |
|
| 190 | - 'uidOwner', |
|
| 191 | - ] |
|
| 192 | - ); |
|
| 193 | - } |
|
| 178 | + /** |
|
| 179 | + * Logs access of shared files |
|
| 180 | + * |
|
| 181 | + * @param array $params |
|
| 182 | + */ |
|
| 183 | + public function shareAccessed(array $params) { |
|
| 184 | + $this->log( |
|
| 185 | + 'The shared %s with the token "%s" by "%s" has been accessed.', |
|
| 186 | + $params, |
|
| 187 | + [ |
|
| 188 | + 'itemType', |
|
| 189 | + 'token', |
|
| 190 | + 'uidOwner', |
|
| 191 | + ] |
|
| 192 | + ); |
|
| 193 | + } |
|
| 194 | 194 | } |
@@ -25,34 +25,34 @@ |
||
| 25 | 25 | |
| 26 | 26 | class AppManagement extends Action { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @param string $appName |
|
| 30 | - */ |
|
| 31 | - public function enableApp($appName) { |
|
| 32 | - $this->log('App "%s" enabled', |
|
| 33 | - ['app' => $appName], |
|
| 34 | - ['app'] |
|
| 35 | - ); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * @param string $appName |
|
| 30 | + */ |
|
| 31 | + public function enableApp($appName) { |
|
| 32 | + $this->log('App "%s" enabled', |
|
| 33 | + ['app' => $appName], |
|
| 34 | + ['app'] |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param string $appName |
|
| 40 | - * @param string[] $groups |
|
| 41 | - */ |
|
| 42 | - public function enableAppForGroups($appName, array $groups) { |
|
| 43 | - $this->log('App "%s" enabled for groups: %s', |
|
| 44 | - ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
| 45 | - ['app', 'groups'] |
|
| 46 | - ); |
|
| 47 | - } |
|
| 38 | + /** |
|
| 39 | + * @param string $appName |
|
| 40 | + * @param string[] $groups |
|
| 41 | + */ |
|
| 42 | + public function enableAppForGroups($appName, array $groups) { |
|
| 43 | + $this->log('App "%s" enabled for groups: %s', |
|
| 44 | + ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
| 45 | + ['app', 'groups'] |
|
| 46 | + ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param string $appName |
|
| 51 | - */ |
|
| 52 | - public function disableApp($appName) { |
|
| 53 | - $this->log('App "%s" disabled', |
|
| 54 | - ['app' => $appName], |
|
| 55 | - ['app'] |
|
| 56 | - ); |
|
| 57 | - } |
|
| 49 | + /** |
|
| 50 | + * @param string $appName |
|
| 51 | + */ |
|
| 52 | + public function disableApp($appName) { |
|
| 53 | + $this->log('App "%s" disabled', |
|
| 54 | + ['app' => $appName], |
|
| 55 | + ['app'] |
|
| 56 | + ); |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -29,137 +29,137 @@ |
||
| 29 | 29 | * @package OCA\AdminAudit\Actions |
| 30 | 30 | */ |
| 31 | 31 | class Files extends Action { |
| 32 | - /** |
|
| 33 | - * Logs file read actions |
|
| 34 | - * |
|
| 35 | - * @param array $params |
|
| 36 | - */ |
|
| 37 | - public function read(array $params) { |
|
| 38 | - $this->log( |
|
| 39 | - 'File accessed: "%s"', |
|
| 40 | - $params, |
|
| 41 | - [ |
|
| 42 | - 'path', |
|
| 43 | - ] |
|
| 44 | - ); |
|
| 45 | - } |
|
| 32 | + /** |
|
| 33 | + * Logs file read actions |
|
| 34 | + * |
|
| 35 | + * @param array $params |
|
| 36 | + */ |
|
| 37 | + public function read(array $params) { |
|
| 38 | + $this->log( |
|
| 39 | + 'File accessed: "%s"', |
|
| 40 | + $params, |
|
| 41 | + [ |
|
| 42 | + 'path', |
|
| 43 | + ] |
|
| 44 | + ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Logs rename actions of files |
|
| 49 | - * |
|
| 50 | - * @param array $params |
|
| 51 | - */ |
|
| 52 | - public function rename(array $params) { |
|
| 53 | - $this->log( |
|
| 54 | - 'File renamed: "%s" to "%s"', |
|
| 55 | - $params, |
|
| 56 | - [ |
|
| 57 | - 'oldpath', |
|
| 58 | - 'newpath', |
|
| 59 | - ] |
|
| 60 | - ); |
|
| 61 | - } |
|
| 47 | + /** |
|
| 48 | + * Logs rename actions of files |
|
| 49 | + * |
|
| 50 | + * @param array $params |
|
| 51 | + */ |
|
| 52 | + public function rename(array $params) { |
|
| 53 | + $this->log( |
|
| 54 | + 'File renamed: "%s" to "%s"', |
|
| 55 | + $params, |
|
| 56 | + [ |
|
| 57 | + 'oldpath', |
|
| 58 | + 'newpath', |
|
| 59 | + ] |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Logs creation of files |
|
| 65 | - * |
|
| 66 | - * @param array $params |
|
| 67 | - */ |
|
| 68 | - public function create(array $params) { |
|
| 69 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
| 70 | - return; |
|
| 71 | - } |
|
| 63 | + /** |
|
| 64 | + * Logs creation of files |
|
| 65 | + * |
|
| 66 | + * @param array $params |
|
| 67 | + */ |
|
| 68 | + public function create(array $params) { |
|
| 69 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
| 70 | + return; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $this->log( |
|
| 74 | - 'File created: "%s"', |
|
| 75 | - $params, |
|
| 76 | - [ |
|
| 77 | - 'path', |
|
| 78 | - ] |
|
| 79 | - ); |
|
| 80 | - } |
|
| 73 | + $this->log( |
|
| 74 | + 'File created: "%s"', |
|
| 75 | + $params, |
|
| 76 | + [ |
|
| 77 | + 'path', |
|
| 78 | + ] |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Logs copying of files |
|
| 84 | - * |
|
| 85 | - * @param array $params |
|
| 86 | - */ |
|
| 87 | - public function copy(array $params) { |
|
| 88 | - $this->log( |
|
| 89 | - 'File copied: "%s" to "%s"', |
|
| 90 | - $params, |
|
| 91 | - [ |
|
| 92 | - 'oldpath', |
|
| 93 | - 'newpath', |
|
| 94 | - ] |
|
| 95 | - ); |
|
| 96 | - } |
|
| 82 | + /** |
|
| 83 | + * Logs copying of files |
|
| 84 | + * |
|
| 85 | + * @param array $params |
|
| 86 | + */ |
|
| 87 | + public function copy(array $params) { |
|
| 88 | + $this->log( |
|
| 89 | + 'File copied: "%s" to "%s"', |
|
| 90 | + $params, |
|
| 91 | + [ |
|
| 92 | + 'oldpath', |
|
| 93 | + 'newpath', |
|
| 94 | + ] |
|
| 95 | + ); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Logs writing of files |
|
| 100 | - * |
|
| 101 | - * @param array $params |
|
| 102 | - */ |
|
| 103 | - public function write(array $params) { |
|
| 104 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
| 105 | - return; |
|
| 106 | - } |
|
| 98 | + /** |
|
| 99 | + * Logs writing of files |
|
| 100 | + * |
|
| 101 | + * @param array $params |
|
| 102 | + */ |
|
| 103 | + public function write(array $params) { |
|
| 104 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
| 105 | + return; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - $this->log( |
|
| 109 | - 'File written to: "%s"', |
|
| 110 | - $params, |
|
| 111 | - [ |
|
| 112 | - 'path', |
|
| 113 | - ] |
|
| 114 | - ); |
|
| 115 | - } |
|
| 108 | + $this->log( |
|
| 109 | + 'File written to: "%s"', |
|
| 110 | + $params, |
|
| 111 | + [ |
|
| 112 | + 'path', |
|
| 113 | + ] |
|
| 114 | + ); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Logs update of files |
|
| 119 | - * |
|
| 120 | - * @param array $params |
|
| 121 | - */ |
|
| 122 | - public function update(array $params) { |
|
| 123 | - $this->log( |
|
| 124 | - 'File updated: "%s"', |
|
| 125 | - $params, |
|
| 126 | - [ |
|
| 127 | - 'path', |
|
| 128 | - ] |
|
| 129 | - ); |
|
| 130 | - } |
|
| 117 | + /** |
|
| 118 | + * Logs update of files |
|
| 119 | + * |
|
| 120 | + * @param array $params |
|
| 121 | + */ |
|
| 122 | + public function update(array $params) { |
|
| 123 | + $this->log( |
|
| 124 | + 'File updated: "%s"', |
|
| 125 | + $params, |
|
| 126 | + [ |
|
| 127 | + 'path', |
|
| 128 | + ] |
|
| 129 | + ); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Logs deletions of files |
|
| 134 | - * |
|
| 135 | - * @param array $params |
|
| 136 | - */ |
|
| 137 | - public function delete(array $params) { |
|
| 138 | - $this->log( |
|
| 139 | - 'File deleted: "%s"', |
|
| 140 | - $params, |
|
| 141 | - [ |
|
| 142 | - 'path', |
|
| 143 | - ] |
|
| 144 | - ); |
|
| 145 | - } |
|
| 132 | + /** |
|
| 133 | + * Logs deletions of files |
|
| 134 | + * |
|
| 135 | + * @param array $params |
|
| 136 | + */ |
|
| 137 | + public function delete(array $params) { |
|
| 138 | + $this->log( |
|
| 139 | + 'File deleted: "%s"', |
|
| 140 | + $params, |
|
| 141 | + [ |
|
| 142 | + 'path', |
|
| 143 | + ] |
|
| 144 | + ); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Logs preview access to a file |
|
| 149 | - * |
|
| 150 | - * @param array $params |
|
| 151 | - */ |
|
| 152 | - public function preview(array $params) { |
|
| 153 | - $this->log( |
|
| 154 | - 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
| 155 | - $params, |
|
| 156 | - [ |
|
| 157 | - 'path', |
|
| 158 | - 'width', |
|
| 159 | - 'height', |
|
| 160 | - 'crop', |
|
| 161 | - 'mode' |
|
| 162 | - ] |
|
| 163 | - ); |
|
| 164 | - } |
|
| 147 | + /** |
|
| 148 | + * Logs preview access to a file |
|
| 149 | + * |
|
| 150 | + * @param array $params |
|
| 151 | + */ |
|
| 152 | + public function preview(array $params) { |
|
| 153 | + $this->log( |
|
| 154 | + 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
| 155 | + $params, |
|
| 156 | + [ |
|
| 157 | + 'path', |
|
| 158 | + 'width', |
|
| 159 | + 'height', |
|
| 160 | + 'crop', |
|
| 161 | + 'mode' |
|
| 162 | + ] |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | 165 | } |
@@ -25,21 +25,21 @@ |
||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | class Console extends Action { |
| 28 | - /** |
|
| 29 | - * @param $arguments |
|
| 30 | - */ |
|
| 31 | - public function runCommand($arguments) { |
|
| 32 | - if ($arguments[1] === '_completion') { |
|
| 33 | - // Don't log autocompletion |
|
| 34 | - return; |
|
| 35 | - } |
|
| 28 | + /** |
|
| 29 | + * @param $arguments |
|
| 30 | + */ |
|
| 31 | + public function runCommand($arguments) { |
|
| 32 | + if ($arguments[1] === '_completion') { |
|
| 33 | + // Don't log autocompletion |
|
| 34 | + return; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - // Remove `./occ` |
|
| 38 | - array_shift($arguments); |
|
| 37 | + // Remove `./occ` |
|
| 38 | + array_shift($arguments); |
|
| 39 | 39 | |
| 40 | - $this->log('Console command executed: %s', |
|
| 41 | - ['arguments' => implode(' ', $arguments)], |
|
| 42 | - ['arguments'] |
|
| 43 | - ); |
|
| 44 | - } |
|
| 40 | + $this->log('Console command executed: %s', |
|
| 41 | + ['arguments' => implode(' ', $arguments)], |
|
| 42 | + ['arguments'] |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -29,33 +29,33 @@ |
||
| 29 | 29 | * @package OCA\AdminAudit\Actions |
| 30 | 30 | */ |
| 31 | 31 | class Auth extends Action { |
| 32 | - public function loginAttempt(array $params) { |
|
| 33 | - $this->log( |
|
| 34 | - 'Login attempt: "%s"', |
|
| 35 | - $params, |
|
| 36 | - [ |
|
| 37 | - 'uid', |
|
| 38 | - ], |
|
| 39 | - true |
|
| 40 | - ); |
|
| 41 | - } |
|
| 32 | + public function loginAttempt(array $params) { |
|
| 33 | + $this->log( |
|
| 34 | + 'Login attempt: "%s"', |
|
| 35 | + $params, |
|
| 36 | + [ |
|
| 37 | + 'uid', |
|
| 38 | + ], |
|
| 39 | + true |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function loginSuccessful(array $params) { |
|
| 44 | - $this->log( |
|
| 45 | - 'Login successful: "%s"', |
|
| 46 | - $params, |
|
| 47 | - [ |
|
| 48 | - 'uid', |
|
| 49 | - ], |
|
| 50 | - true |
|
| 51 | - ); |
|
| 52 | - } |
|
| 43 | + public function loginSuccessful(array $params) { |
|
| 44 | + $this->log( |
|
| 45 | + 'Login successful: "%s"', |
|
| 46 | + $params, |
|
| 47 | + [ |
|
| 48 | + 'uid', |
|
| 49 | + ], |
|
| 50 | + true |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function logout(array $params) { |
|
| 55 | - $this->log( |
|
| 56 | - 'Logout occurred', |
|
| 57 | - [], |
|
| 58 | - [] |
|
| 59 | - ); |
|
| 60 | - } |
|
| 54 | + public function logout(array $params) { |
|
| 55 | + $this->log( |
|
| 56 | + 'Logout occurred', |
|
| 57 | + [], |
|
| 58 | + [] |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -33,69 +33,69 @@ |
||
| 33 | 33 | * @package OCA\AdminAudit\Actions |
| 34 | 34 | */ |
| 35 | 35 | class UserManagement extends Action { |
| 36 | - /** |
|
| 37 | - * Log creation of users |
|
| 38 | - * |
|
| 39 | - * @param array $params |
|
| 40 | - */ |
|
| 41 | - public function create(array $params) { |
|
| 42 | - $this->log( |
|
| 43 | - 'User created: "%s"', |
|
| 44 | - $params, |
|
| 45 | - [ |
|
| 46 | - 'uid', |
|
| 47 | - ] |
|
| 48 | - ); |
|
| 49 | - } |
|
| 36 | + /** |
|
| 37 | + * Log creation of users |
|
| 38 | + * |
|
| 39 | + * @param array $params |
|
| 40 | + */ |
|
| 41 | + public function create(array $params) { |
|
| 42 | + $this->log( |
|
| 43 | + 'User created: "%s"', |
|
| 44 | + $params, |
|
| 45 | + [ |
|
| 46 | + 'uid', |
|
| 47 | + ] |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Log deletion of users |
|
| 53 | - * |
|
| 54 | - * @param array $params |
|
| 55 | - */ |
|
| 56 | - public function delete(array $params) { |
|
| 57 | - $this->log( |
|
| 58 | - 'User deleted: "%s"', |
|
| 59 | - $params, |
|
| 60 | - [ |
|
| 61 | - 'uid', |
|
| 62 | - ] |
|
| 63 | - ); |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * Log deletion of users |
|
| 53 | + * |
|
| 54 | + * @param array $params |
|
| 55 | + */ |
|
| 56 | + public function delete(array $params) { |
|
| 57 | + $this->log( |
|
| 58 | + 'User deleted: "%s"', |
|
| 59 | + $params, |
|
| 60 | + [ |
|
| 61 | + 'uid', |
|
| 62 | + ] |
|
| 63 | + ); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Log enabling of users |
|
| 68 | - * |
|
| 69 | - * @param array $params |
|
| 70 | - */ |
|
| 71 | - public function change(array $params) { |
|
| 72 | - if ($params['feature'] === 'enabled') { |
|
| 73 | - $this->log( |
|
| 74 | - $params['value'] === 'true' ? 'User enabled: "%s"' : 'User disabled: "%s"', |
|
| 75 | - ['user' => $params['user']->getUID()], |
|
| 76 | - [ |
|
| 77 | - 'user', |
|
| 78 | - ] |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - } |
|
| 66 | + /** |
|
| 67 | + * Log enabling of users |
|
| 68 | + * |
|
| 69 | + * @param array $params |
|
| 70 | + */ |
|
| 71 | + public function change(array $params) { |
|
| 72 | + if ($params['feature'] === 'enabled') { |
|
| 73 | + $this->log( |
|
| 74 | + $params['value'] === 'true' ? 'User enabled: "%s"' : 'User disabled: "%s"', |
|
| 75 | + ['user' => $params['user']->getUID()], |
|
| 76 | + [ |
|
| 77 | + 'user', |
|
| 78 | + ] |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Logs changing of the user scope |
|
| 85 | - * |
|
| 86 | - * @param IUser $user |
|
| 87 | - */ |
|
| 88 | - public function setPassword(IUser $user) { |
|
| 89 | - if($user->getBackendClassName() === 'Database') { |
|
| 90 | - $this->log( |
|
| 91 | - 'Password of user "%s" has been changed', |
|
| 92 | - [ |
|
| 93 | - 'user' => $user->getUID(), |
|
| 94 | - ], |
|
| 95 | - [ |
|
| 96 | - 'user', |
|
| 97 | - ] |
|
| 98 | - ); |
|
| 99 | - } |
|
| 100 | - } |
|
| 83 | + /** |
|
| 84 | + * Logs changing of the user scope |
|
| 85 | + * |
|
| 86 | + * @param IUser $user |
|
| 87 | + */ |
|
| 88 | + public function setPassword(IUser $user) { |
|
| 89 | + if($user->getBackendClassName() === 'Database') { |
|
| 90 | + $this->log( |
|
| 91 | + 'Password of user "%s" has been changed', |
|
| 92 | + [ |
|
| 93 | + 'user' => $user->getUID(), |
|
| 94 | + ], |
|
| 95 | + [ |
|
| 96 | + 'user', |
|
| 97 | + ] |
|
| 98 | + ); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | } |