Update changelog, fix log reference.

This commit is contained in:
James Cole
2025-02-22 08:07:52 +01:00
parent 48c1b525be
commit a4637debe9
2 changed files with 20 additions and 17 deletions

View File

@@ -31,6 +31,7 @@ use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
/** /**
* Class RemoteUserGuard * Class RemoteUserGuard
@@ -48,7 +49,7 @@ class RemoteUserGuard implements Guard
{ {
/** @var null|Request $request */ /** @var null|Request $request */
$request = $app->get('request'); $request = $app->get('request');
app('log')->debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri())); Log::debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));
$this->application = $app; $this->application = $app;
$this->provider = $provider; $this->provider = $provider;
$this->user = null; $this->user = null;
@@ -56,9 +57,9 @@ class RemoteUserGuard implements Guard
public function authenticate(): void public function authenticate(): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
if (null !== $this->user) { if (null !== $this->user) {
app('log')->debug(sprintf('%s is found: #%d, "%s".', get_class($this->user), $this->user->id, $this->user->email)); Log::debug(sprintf('%s is found: #%d, "%s".', get_class($this->user), $this->user->id, $this->user->email));
return; return;
} }
@@ -67,17 +68,17 @@ class RemoteUserGuard implements Guard
$userID = request()->server($header) ?? null; $userID = request()->server($header) ?? null;
if (function_exists('apache_request_headers')) { if (function_exists('apache_request_headers')) {
app('log')->debug('Use apache_request_headers to find user ID.'); Log::debug('Use apache_request_headers to find user ID.');
$userID = request()->server($header) ?? apache_request_headers()[$header] ?? null; $userID = request()->server($header) ?? apache_request_headers()[$header] ?? null;
} }
if (null === $userID || '' === $userID) { if (null === $userID || '' === $userID) {
app('log')->error(sprintf('No user in header "%s".', $header)); Log::error(sprintf('No user in header "%s".', $header));
throw new FireflyException('The guard header was unexpectedly empty. See the logs.'); throw new FireflyException('The guard header was unexpectedly empty. See the logs.');
} }
app('log')->debug(sprintf('User ID found in header is "%s"', $userID)); Log::debug(sprintf('User ID found in header is "%s"', $userID));
/** @var User $retrievedUser */ /** @var User $retrievedUser */
$retrievedUser = $this->provider->retrieveById($userID); $retrievedUser = $this->provider->retrieveById($userID);
@@ -98,30 +99,30 @@ class RemoteUserGuard implements Guard
} }
} }
app('log')->debug(sprintf('Result of getting user from provider: %s', $retrievedUser->email)); Log::debug(sprintf('Result of getting user from provider: %s', $retrievedUser->email));
$this->user = $retrievedUser; $this->user = $retrievedUser;
} }
public function guest(): bool public function guest(): bool
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
return !$this->check(); return !$this->check();
} }
public function check(): bool public function check(): bool
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
return null !== $this->user(); return null !== $this->user();
} }
public function user(): ?User public function user(): ?User
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
$user = $this->user; $user = $this->user;
if (null === $user) { if (null === $user) {
app('log')->debug('User is NULL'); Log::debug('User is NULL');
return null; return null;
} }
@@ -131,7 +132,7 @@ class RemoteUserGuard implements Guard
public function hasUser(): bool public function hasUser(): bool
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException('Did not implement RemoteUserGuard::hasUser()'); throw new FireflyException('Did not implement RemoteUserGuard::hasUser()');
} }
@@ -141,20 +142,20 @@ class RemoteUserGuard implements Guard
*/ */
public function id(): null|int|string public function id(): null|int|string
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
return $this->user?->id; return $this->user?->id;
} }
public function setUser(null|Authenticatable|User $user): void // @phpstan-ignore-line public function setUser(null|Authenticatable|User $user): void // @phpstan-ignore-line
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
if ($user instanceof User) { if ($user instanceof User) {
$this->user = $user; $this->user = $user;
return; return;
} }
app('log')->error(sprintf('Did not set user at %s', __METHOD__)); Log::error(sprintf('Did not set user at %s', __METHOD__));
} }
/** /**
@@ -164,14 +165,14 @@ class RemoteUserGuard implements Guard
*/ */
public function validate(array $credentials = []): bool public function validate(array $credentials = []): bool
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException('Did not implement RemoteUserGuard::validate()'); throw new FireflyException('Did not implement RemoteUserGuard::validate()');
} }
public function viaRemember(): bool public function viaRemember(): bool
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); Log::debug(sprintf('Now at %s', __METHOD__));
return false; return false;
} }

View File

@@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [Issue 9868](https://github.com/firefly-iii/firefly-iii/issues/9868) (API: `TransactionSplit` -> `transaction_journal_id` returns int, not String) reported by @dreautall - [Issue 9868](https://github.com/firefly-iii/firefly-iii/issues/9868) (API: `TransactionSplit` -> `transaction_journal_id` returns int, not String) reported by @dreautall
- [Issue 9871](https://github.com/firefly-iii/firefly-iii/issues/9871) (include net worth is ignored in the API - from PICO developer) reported by @fate8383 - [Issue 9871](https://github.com/firefly-iii/firefly-iii/issues/9871) (include net worth is ignored in the API - from PICO developer) reported by @fate8383
- [Issue 9882](https://github.com/firefly-iii/firefly-iii/issues/9882) (Reconciliation bug on Docker instance) reported by @benjaminteyssier - [Issue 9882](https://github.com/firefly-iii/firefly-iii/issues/9882) (Reconciliation bug on Docker instance) reported by @benjaminteyssier
- #9884
- #9887
## 6.2.7 - 2025-02-19 ## 6.2.7 - 2025-02-19