Skip to content

Commit

Permalink
chore: Make sure the token repository has a fallback when not in mult…
Browse files Browse the repository at this point in the history
…itenanted context
  • Loading branch information
ollieread committed Nov 18, 2024
1 parent dab2eaa commit 3725f5f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class TenantAwareDatabaseTokenRepository extends DatabaseTokenRepository
*/
protected function getPayload($email, #[SensitiveParameter] $token): array

Check warning on line 37 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L37

Added line #L37 was not covered by tests
{
if (! sprout()->withinContext()) {
return parent::getPayload($email, $token);

Check warning on line 40 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L39-L40

Added lines #L39 - L40 were not covered by tests
}

$tenancy = sprout()->getCurrentTenancy();

Check warning on line 43 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L43

Added line #L43 was not covered by tests

if ($tenancy === null) {
Expand Down Expand Up @@ -67,6 +71,10 @@ protected function getPayload($email, #[SensitiveParameter] $token): array
*/
protected function getTenantedQuery(string $email): Builder

Check warning on line 72 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L72

Added line #L72 was not covered by tests
{
if (! sprout()->withinContext()) {
return $this->getTable()->where('email', $email);

Check warning on line 75 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L74-L75

Added lines #L74 - L75 were not covered by tests
}

$tenancy = sprout()->getCurrentTenancy();

Check warning on line 78 in src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php

View check run for this annotation

Codecov / codecov/patch

src/Overrides/Auth/TenantAwareDatabaseTokenRepository.php#L78

Added line #L78 was not covered by tests

if ($tenancy === null) {
Expand Down

0 comments on commit 3725f5f

Please sign in to comment.