diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-08-25 09:57:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 09:57:30 +0200 |
commit | 8aad5399189a8f238ff1dfe423f8f44a3117f2ac (patch) | |
tree | 8262e5626f58bbc0046f5ccd4293ebaf421765dd | |
parent | 146cc6ad451fb5e9f9e3dfa0376173733214171d (diff) | |
parent | 8277d0a5aa1ab475e3c03656eb48641536256a6f (diff) | |
download | nextcloud-server-8aad5399189a8f238ff1dfe423f8f44a3117f2ac.tar.gz nextcloud-server-8aad5399189a8f238ff1dfe423f8f44a3117f2ac.zip |
Merge pull request #40034 from nextcloud/fix/stable27/log-condition-user
[stable27] Fix user log.condition feature
-rw-r--r-- | lib/private/Log.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php index a83e652f8d3..ff13e039024 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -38,17 +38,18 @@ namespace OC; use Exception; use Nextcloud\LogNormalizer\Normalizer; -use OC\AppFramework\Bootstrap\Coordinator; use OCP\EventDispatcher\IEventDispatcher; +use OCP\ILogger; +use OCP\IUserSession; use OCP\Log\BeforeMessageLoggedEvent; use OCP\Log\IDataLogger; -use Throwable; -use function array_merge; -use OC\Log\ExceptionSerializer; -use OCP\ILogger; use OCP\Log\IFileBased; use OCP\Log\IWriter; use OCP\Support\CrashReport\IRegistry; +use OC\AppFramework\Bootstrap\Coordinator; +use OC\Log\ExceptionSerializer; +use Throwable; +use function array_merge; use function strtr; /** @@ -274,10 +275,13 @@ class Log implements ILogger, IDataLogger { // check for user if (isset($logCondition['users'])) { - $user = \OC::$server->getUserSession()->getUser(); + $user = \OCP\Server::get(IUserSession::class)->getUser(); - // if the user matches set the log condition to satisfied - if ($user !== null && in_array($user->getUID(), $logCondition['users'], true)) { + if ($user === null) { + // User is not known for this request yet + $this->logConditionSatisfied = null; + } elseif (in_array($user->getUID(), $logCondition['users'], true)) { + // if the user matches set the log condition to satisfied $this->logConditionSatisfied = true; } } |