diff --git a/app/Console/Commands/Integrity/CreateGroupMemberships.php b/app/Console/Commands/Integrity/CreateGroupMemberships.php index 9bae7b062a..eadee46f80 100644 --- a/app/Console/Commands/Integrity/CreateGroupMemberships.php +++ b/app/Console/Commands/Integrity/CreateGroupMemberships.php @@ -79,17 +79,18 @@ class CreateGroupMemberships extends Command /** @var User $user */ foreach ($users as $user) { Log::debug(sprintf('Manage group memberships for user #%d', $user->id)); - $this->createGroupMembership($user); + self::createGroupMembership($user); Log::debug(sprintf('Done with user #%d', $user->id)); } } /** + * TODO move to helper. * @param User $user * * @throws FireflyException */ - private function createGroupMembership(User $user): void + public static function createGroupMembership(User $user): void { // check if membership exists $userGroup = UserGroup::where('title', $user->email)->first(); diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index 9edee6510c..736bc68df3 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -41,8 +41,8 @@ use Psr\Container\NotFoundExceptionInterface; class RemoteUserGuard implements Guard { protected Application $application; - protected $provider; - protected $user; + protected $provider; + protected $user; /** * Create a new authentication guard. diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index 835fd0a500..5c62f9bdf8 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Support\Authentication; +use FireflyIII\Console\Commands\Integrity\CreateGroupMemberships; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Role; use FireflyIII\User; @@ -68,6 +69,8 @@ class RemoteUserProvider implements UserProvider $roleObject = Role::where('name', 'owner')->first(); $user->roles()->attach($roleObject); } + // make sure the user gets an administration as well. + CreateGroupMemberships::createGroupMembership($user); } Log::debug(sprintf('Going to return user #%d (%s)', $user->id, $user->email));