Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Drop autologout for no-longer-supported onetimeaccount logins #3556

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Removed

- Drop the autologout for no-longer-supported onetimeaccount logins (#3556)
- Drop `$isFileName` parameter in `::getConfValueString()` (#2835)
- Remove the `omitDateIfSameAsPrevious` setting (#2314)
- Drop `SeparateBillingAddressUpgradeWizard` (#3496)
Expand Down
19 changes: 2 additions & 17 deletions Classes/Service/OneTimeAccountConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ public function __construct()
$this->frontEndUserAuthentication = $frontEndUserAuthentication;
}

/**
* Checks whether a login session is active, and that is has been created by the "onetimeaccount" extension.
*/
public function existsOneTimeAccountLoginSession(): bool
{
return $this->frontEndUserAuthentication->getKey('user', 'onetimeaccount') === true;
}

/**
* Returns the user UID of a FE user created by the "onetimeaccount" extension (without a FE login session).
*
Expand All @@ -59,19 +51,12 @@ public function getOneTimeAccountUserUid(): ?int
}

/**
* Destroys any onetimeaccount sessions (with or without login).
*
* If a onetimeaccount login session is active, the user will be logged out.
* Destroys any onetimeaccount sessions (without login).
*
* If no user is logged in, but a onetimeaccount user UID is available in the session, it will be deleted.
*
* If regular FE user is logged in, nothing happens.
* If a onetimeaccount user UID is available in the session, it will be deleted.
*/
public function destroyOneTimeSession(): void
{
if ($this->existsOneTimeAccountLoginSession()) {
$this->frontEndUserAuthentication->logoff();
}
if (\is_int($this->getOneTimeAccountUserUid())) {
$this->frontEndUserAuthentication->setAndSaveSessionData('onetimeaccountUserUid', null);
}
Expand Down
58 changes: 0 additions & 58 deletions Tests/Unit/Service/OneTimeAccountConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,6 @@ public function isSingleton(): void
self::assertInstanceOf(SingletonInterface::class, $this->subject);
}

/**
* @test
*/
public function existsOneTimeAccountLoginSessionForNoSessionDataReturnsFalse(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);

self::assertFalse($this->subject->existsOneTimeAccountLoginSession());
}

/**
* @test
*/
public function existsOneTimeAccountLoginSessionForSessionDataReturnsTrue(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(true);

self::assertTrue($this->subject->existsOneTimeAccountLoginSession());
}

/**
* @test
*/
Expand Down Expand Up @@ -143,18 +123,6 @@ public function getOneTimeAccountUserUidForPositiveUserUidReturnsUserUid(): void
self::assertSame($userUid, $this->subject->getOneTimeAccountUserUid());
}

/**
* @test
*/
public function destroyOneTimeSessionForRegularLoginDoesNotLogUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);

$this->frontEndUserAuthenticationMock->expects(self::never())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand All @@ -167,18 +135,6 @@ public function destroyOneTimeSessionForRegularLoginDoesSetAnySessionDate(): voi
$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
public function destroyOneTimeSessionForOneTimeLoginLogsUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(true);

$this->frontEndUserAuthenticationMock->expects(self::once())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand All @@ -194,20 +150,6 @@ public function destroyOneTimeSessionForOneTimeSessionWithoutLoginRemovesUserUid
$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
public function destroyOneTimeSessionForRegularLoginAndOneTimeSessionDoesNotLogUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);
$this->frontEndUserAuthenticationMock->method('getSessionData')->with('onetimeaccountUserUid')
->willReturn(5);

$this->frontEndUserAuthenticationMock->expects(self::never())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand Down