Browse Source

don't try to log the currently logged in user, this fails on cronjobs. The users are logged anyway

tags/v10.0RC1
Bjoern Schiessle 8 years ago
parent
commit
f9fd7093c0
No account linked to committer's email address
2 changed files with 5 additions and 31 deletions
  1. 4
    30
      apps/admin_audit/lib/actions/trashbin.php
  2. 1
    1
      apps/admin_audit/lib/auditlogger.php

+ 4
- 30
apps/admin_audit/lib/actions/trashbin.php View File

@@ -28,41 +28,15 @@ use OCP\IUserSession;

class Trashbin extends Action {

/** @var IUserSession */
private $userSession;

/**
* Trashbin constructor.
*
* @param ILogger $logger
* @param IUserSession $userSession
*/
public function __construct(ILogger $logger, IUserSession $userSession) {
parent::__construct($logger);
$this->userSession = $userSession;
}

public function delete($params) {
$this->log('File "%s" deleted from trash bin by "%s"',
[
'path' => $params['path'],
'user' => $this->userSession->getUser()->getUID()
],
[
'path', 'user'
]
$this->log('File "%s" deleted from trash bin.',
['path' => $params['path']], ['path']
);
}

public function restore($params) {
$this->log('File "%s" restored from trash bin by "%s"',
[
'path' => $params['filePath'],
'user' => $this->userSession->getUser()->getUID()
],
[
'path', 'user'
]
$this->log('File "%s" restored from trash bin.',
['path' => $params['filePath']], ['path']
);
}


+ 1
- 1
apps/admin_audit/lib/auditlogger.php View File

@@ -178,7 +178,7 @@ class AuditLogger {
* connect to trash bin hooks
*/
private function trashbinHooks() {
$trashActions = new Trashbin($this->logger, $this->userSession);
$trashActions = new Trashbin($this->logger);
Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete');
Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore');
}

Loading…
Cancel
Save