Skip to content

Firefly III: a personal finances manager

Merge branch 'develop' into 5.8-dev

James Cole67434bb8a59d
diff --cc app/Http/Kernel.php
index 9b91bcd373,5dbc366ee1..51e0dc48f9
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@@ -178,8 -176,8 +178,9 @@@ class Kernel extends HttpKerne
CreateFreshApiToken::class,
],
+ // full API authentication
'api' => [
+ AcceptHeaders::class,
EnsureFrontendRequestsAreStateful::class,
'auth:api,sanctum',
'bindings',
diff --cc app/Http/Middleware/Authenticate.php
index 0a346826ea,bacdcf6547..743eb9b283
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@@ -105,20 -115,12 +114,11 @@@ class Authenticat
throw new AuthenticationException('Blocked account.', $guards);
}
}
- } catch (QueryException $e) {
- throw new FireflyException(
- sprintf(
- 'It seems the database has not yet been initialized. Did you run the correct upgrade or installation commands? Error: %s',
- $e->getMessage()
- ),
- 0,
- $e
- );
}
- /** @noinspection PhpUndefinedMethodInspection */
- return $this->auth->authenticate();
+ return $this->auth->authenticate(); // @phpstan-ignore-line (thinks function returns void)
}
-
+ Log::debug('Guard array is not empty.');
foreach ($guards as $guard) {
if ($this->auth->guard($guard)->check()) {
diff --cc app/Models/Account.php
index 4ae11fdcc6,5575ab5631..8f94933839
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@@ -291,4 -282,25 +292,16 @@@ class Account extends Mode
{
return $this->hasMany(Transaction::class);
}
+
- /**
- * @return BelongsTo
- * @codeCoverageIgnore
- */
- public function user(): BelongsTo
- {
- return $this->belongsTo(User::class);
- }
-
+ /**
+ * Get the virtual balance
+ *
+ * @return Attribute
+ */
+ protected function virtualBalance(): Attribute
+ {
+ return Attribute::make(
+ get: fn($value) => (string) $value,
+ );
+ }
}
diff --cc app/Support/Authentication/RemoteUserGuard.php
index 46e63875a0,1086ddaa58..636bb0d6dd
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@@ -47,8 -48,12 +48,11 @@@ class RemoteUserGuard implements Guar
* @param UserProvider $provider
* @param Application $app
*/
- // @phpstan-ignore-next-line
- public function __construct(UserProvider $provider, Application $app) // @phpstan-ignore-line
+ public function __construct(UserProvider $provider, Application $app)
{
+ /** @var Request $request */
+ $request = $app->get('request');
+ Log::debug(sprintf('Created RemoteUserGuard for "%s"', $request?->getRequestUri()));
$this->application = $app;
$this->provider = $provider;
$this->user = null;
@@@ -124,9 -146,10 +145,10 @@@
/**
* @inheritDoc
*/
- public function hasUser()
+ public function hasUser(): bool
{
- throw new FireflyException(sprintf('%s is not implemented', __METHOD__));
+ Log::debug(sprintf('Now at %s', __METHOD__));
+ // TODO: Implement hasUser() method.
}
/**