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

[FEATURE] TYPO3 v12 reactions support #107

Merged
merged 89 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
b543314
Merge branch '101-php-82-support' into typo3v12
mabolek Aug 24, 2023
534ecc9
[!!!][TASK] Raise TYPO3 requirement to v11
mabolek Aug 24, 2023
eea8072
[!!!][TASK] Remove TYPO3 <v11 from CI
mabolek Aug 24, 2023
9ebd083
[CLEANUP] CS fixes
mabolek Aug 24, 2023
4e49330
[TASK] Comply with stricter PhpStan rules
mabolek Aug 24, 2023
bef56a2
[FEATURE] Configurable handling of empty files
mabolek Aug 25, 2023
811db39
[CLEANUP] Remove expired CompatibilityUtility references
mabolek Aug 25, 2023
b98057d
[!!!][TASK] Raise TYPO3 requirement to v11
mabolek Aug 24, 2023
fd44bef
[!!!][TASK] Remove TYPO3 <v11 from CI
mabolek Aug 24, 2023
2c940ab
[CLEANUP] CS fixes
mabolek Aug 24, 2023
c0bc39e
[TASK] Comply with stricter PhpStan rules
mabolek Aug 24, 2023
6510aea
[FEATURE] Configurable handling of empty files
mabolek Aug 25, 2023
2365c63
[CLEANUP] Remove expired CompatibilityUtility references
mabolek Aug 25, 2023
7077779
Merge remote-tracking branch 'origin/typo3v12' into typo3v12
mabolek Aug 25, 2023
6d650a7
[TASK] Add TYPO3 v12.4 to composer.json
mabolek Aug 25, 2023
1b2a126
[TASK] Rector code changes for TYPO3 v11
mabolek Aug 25, 2023
ea0025b
[TASK] DDEV: Use PHP 8.1
mabolek Aug 25, 2023
a778790
[CLEANUP] CS fixes
mabolek Aug 25, 2023
98b91e7
[TASK] Further PhpStan corrections
mabolek Aug 25, 2023
bce40dc
[TASK] Remove class that's no longer needed
mabolek Aug 25, 2023
2c02ff6
[WIP] Temporarily exlude HttpBackendUserAuthentication from PhpStan
mabolek Aug 25, 2023
33e5cfc
[TASK] Increase compatibility of tests in TYPO3 v11
mabolek Aug 28, 2023
c9d8415
[TASK] Refactor DB execute calls with Rector
mabolek Aug 28, 2023
cbb7f38
[TASK] Database-related refactoring
mabolek Aug 28, 2023
00af388
[TASK] Simplify conditions
mabolek Aug 28, 2023
e5b3d14
[TASK] TCA types 'file' and 'image' are relational
mabolek Aug 28, 2023
35ece1a
[TASK] Remove field table_local in sys_file_reference for v12
mabolek Aug 28, 2023
4e6032a
[TASK] Always convert array field values to comma separated
mabolek Aug 28, 2023
7ad3e30
[!!!][TASK] Remove deprecated getData() and setData()
mabolek Aug 28, 2023
917da03
[TASK] Add TYPO3 v12 to GitHub CI
mabolek Aug 28, 2023
f7ef6f9
[TASK] Remove support for doctrine/dbal ^2.13.9
mabolek Aug 28, 2023
7fc3f9a
Revert "[TASK] Remove support for doctrine/dbal ^2.13.9"
mabolek Aug 28, 2023
b502762
[TASK] Require at least TYPO3 12.4.3
mabolek Aug 28, 2023
80439b7
[TASK] Remove CI tests for TYPO3 v12 and PHP 8.0
mabolek Aug 28, 2023
8e96de2
[TASK] Remove accidental additional arrays in tests
mabolek Aug 28, 2023
71097af
[CLEANUP] CS fixes
mabolek Aug 28, 2023
ebfc595
[TASK] Exlude CompatibilityUtility from PhpStan
mabolek Aug 28, 2023
cd986b6
[CLEANUP] Remove unused import
mabolek Aug 28, 2023
67ce2ef
[CLEANUP] CS fixes
mabolek Aug 28, 2023
b2ab4eb
[CLEANUP] CS fixes
mabolek Aug 28, 2023
7c10c4e
Revert "[TASK] Exlude CompatibilityUtility from PhpStan"
mabolek Aug 28, 2023
9132c8f
[TASK] Ignore CompatibilityUtility in PhpCS
mabolek Aug 28, 2023
4c08680
[TASK] Implement v12 backportin in tx_interest_remote_id_mapping
mabolek Aug 28, 2023
773b550
[TASK] Remove extbase dependency
mabolek Aug 28, 2023
52ac31a
[TASK] Check if key exists
mabolek Aug 28, 2023
a023717
[TASK] Reintroduce forced zero for empty translation field
mabolek Aug 28, 2023
bc0fdcd
[TASK] Raise doctrine/dbal requirement to ^2.13.9
mabolek Aug 28, 2023
235a9c0
Revert "[TASK] Raise doctrine/dbal requirement to ^2.13.9"
mabolek Aug 28, 2023
b3569fe
[TASK] Raise TYPO3 requirement to ^11.5.8
mabolek Aug 28, 2023
7728951
[TASK] Raise TYPO3 requirement to ^12.4.6
mabolek Aug 28, 2023
b948caa
[TASK] Rewrite authentication code
mabolek Sep 4, 2023
6fea694
[TASK] Ensure compatibility with v11 and v12
mabolek Sep 4, 2023
3c9c03f
[CLEANUP] CS fixes
mabolek Sep 4, 2023
0facad1
[CLEANUP] CS fixes
mabolek Sep 4, 2023
4ede289
[CLEANUP] CS fixes
mabolek Sep 4, 2023
9562cf9
[CLEANUP] CS fixes
mabolek Sep 4, 2023
93aa637
[CLEANUP] CS fixes
mabolek Sep 4, 2023
df61961
[CLEANUP] CS fixes
mabolek Sep 4, 2023
8834330
Revert "[CLEANUP] CS fixes"
mabolek Sep 4, 2023
2dcfdd0
[TASK] Don't use imports for version-dependent classes
mabolek Sep 6, 2023
3354770
[TASK] Don't use imports for version-dependent classes
mabolek Sep 6, 2023
b837825
[TASK] Reintroduce dynamic compatibility class loading
mabolek Sep 11, 2023
40a1c0b
[WIP] Basic scaffolding
mabolek Sep 12, 2023
572867d
[BUGFIX] Remove $imageUpdates overwrite in UpdateRecordOperationTest
mabolek Aug 24, 2023
8150764
[TASK] Require typo3/testing-framework ^7.0.4
mabolek Sep 12, 2023
082b7c5
[TASK] Directly parse request body as associative array
mabolek Sep 13, 2023
0b093c0
[FEATURE] TYPO3 v12 reactions support
mabolek Sep 13, 2023
74e8833
[CLEANUP] CS fixes
mabolek Sep 13, 2023
75dc3d5
[TASK] Make PhpStan verbose
mabolek Sep 13, 2023
bc05150
[TASK] Don't exclude Classes/Authentication/ in PhpStan
mabolek Sep 13, 2023
404143f
[TASK] Ignore CreateUpdateDeleteReaction.php in PhpStan
mabolek Sep 13, 2023
cec5bce
Revert "[TASK] Don't exclude Classes/Authentication/ in PhpStan"
mabolek Sep 13, 2023
cff8de0
[BUGFIX] Remove $imageUpdates overwrite in UpdateRecordOperationTest
mabolek Aug 24, 2023
93283cb
[TASK] Multiple fixes and improvements
mabolek Sep 13, 2023
bd8439d
[CLEANUP] Re-enable cyclomatic complexity check
mabolek Sep 13, 2023
d4bea13
Revert "[CLEANUP] Re-enable cyclomatic complexity check"
mabolek Sep 13, 2023
759ca4a
[TASK] Only set metadata if `$parsedBody['metaData']` is set
mabolek Sep 13, 2023
4626e4a
[BUGFIX] Remove $imageUpdates overwrite in UpdateRecordOperationTest
mabolek Aug 24, 2023
c0876da
[TASK] 422 response for no operations supplied
mabolek Sep 13, 2023
9685613
[TASK] Correct test
mabolek Sep 13, 2023
a7ff78c
[TASK] Test for reactions in TYPO3 v12
mabolek Sep 17, 2023
14c8f88
[CLEANUP] CS fixes
mabolek Sep 17, 2023
afe58a0
[CLEANUP] CS fixes
mabolek Sep 17, 2023
837d64c
[TASK] Test HttpRequestRouter
mabolek Sep 17, 2023
b7854ba
[TASK] Mock EventDispatcher
mabolek Sep 19, 2023
cd6d26e
[CLEANUP] CS fixes
mabolek Sep 19, 2023
66aecd4
[DOCS] Documenting webhooks
mabolek Sep 19, 2023
c98ed6b
[DOCS] Remove extra comma in JSON
mabolek Sep 20, 2023
fff4417
Merge branch 'master' into typo3v12-reactions
mabolek Nov 1, 2023
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
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: interest
type: php
docroot: ""
php_version: "7.4"
php_version: "8.1"
webserver_type: nginx-fpm
#router_http_port: "8081"
#router_https_port: "4434"
Expand Down
62 changes: 36 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ jobs:
- name: "Install TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
ADDITIONAL_REQUIREMENTS: "${{ matrix.additional-requirements }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/minimal:"$TYPO3"
composer require --no-ansi --no-interaction --no-progress --no-install typo3/minimal:"$TYPO3" $ADDITIONAL_REQUIREMENTS
composer show
- name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'"
Expand All @@ -121,18 +122,6 @@ jobs:
fail-fast: false
matrix:
include:
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^11.5
php-version: 7.4
composer-dependencies: highest
Expand All @@ -157,6 +146,22 @@ jobs:
- typo3-version: ^11.5
php-version: 8.2
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: highest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: lowest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: highest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: lowest
additional-requirements: "typo3/cms-reactions"
functional-tests:
name: "Functional tests"
runs-on: ubuntu-20.04
Expand All @@ -182,8 +187,9 @@ jobs:
- name: "Install TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
ADDITIONAL_REQUIREMENTS: "${{ matrix.additional-requirements }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/minimal:"$TYPO3"
composer require --no-ansi --no-interaction --no-progress --no-install typo3/minimal:"$TYPO3" $ADDITIONAL_REQUIREMENTS
composer show
- name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'"
Expand All @@ -208,18 +214,6 @@ jobs:
fail-fast: false
matrix:
include:
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^11.5
php-version: 7.4
composer-dependencies: highest
Expand All @@ -244,3 +238,19 @@ jobs:
- typo3-version: ^11.5
php-version: 8.2
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: highest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: lowest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: highest
additional-requirements: "typo3/cms-reactions"
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: lowest
additional-requirements: "typo3/cms-reactions"
2 changes: 1 addition & 1 deletion .php_cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
Expand Down
111 changes: 111 additions & 0 deletions Classes/Authentication/AbstractHttpBackendUserAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php

declare(strict_types=1);

namespace Pixelant\Interest\Authentication;

use Pixelant\Interest\RequestHandler\Exception\InvalidArgumentException;
use Pixelant\Interest\RequestHandler\Exception\UnauthorizedAccessException;
use Pixelant\Interest\Utility\CompatibilityUtility;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Authentication\LoginType;
use TYPO3\CMS\Core\Utility\GeneralUtility;

abstract class AbstractHttpBackendUserAuthentication extends BackendUserAuthentication
{
/**
* Check if user is authenticated.
*
* @return bool
*/
public function isAuthenticated(): bool
{
return $this->getUserId() !== 0;
}

/**
* Returns the user's UID.
*
* @return int
*/
public function getUserId(): int
{
return $this->user['uid'] ?? 0;
}

/**
* Fetches login credentials from basic HTTP authentication header.
*
* @param ServerRequestInterface $request
* @return array
* @throws UnauthorizedAccessException
* @throws InvalidArgumentException
*/
protected function internalGetLoginFormData(ServerRequestInterface $request)
{
if (strtolower($request->getMethod()) !== 'post') {
throw new UnauthorizedAccessException(
'Authorization requires POST method.',
$request
);
}

$authorizationHeader = $request->getHeader('authorization')[0]
?? $request->getHeader('redirect_http_authorization')[0]
?? '';

[$scheme, $authorizationData] = GeneralUtility::trimExplode(' ', $authorizationHeader, true);

if ($scheme === null) {
throw new InvalidArgumentException(
'No authorization scheme provided.',
$request
);
}

if (strtolower($scheme) !== 'basic') {
throw new InvalidArgumentException(
'Unknown authorization scheme "' . $scheme . '".',
$request
);
}

$authorizationData = base64_decode($authorizationData, true);

if (strpos($authorizationData, ':') === false) {
throw new InvalidArgumentException(
'Authorization data couldn\'t be decoded. Missing ":" separating username and password.',
$request
);
}

[$username, $password] = explode(':', $authorizationData);

$loginData = [
'status' => LoginType::LOGIN,
'uname' => $username,
'uident' => $password,
];

if (CompatibilityUtility::typo3VersionIsLessThan('12.0')) {
return $this->processLoginData($loginData);
}

return $this->processLoginData($loginData, $request);
}

/**
* Returns the authentication service configuration with `BE_fetchUserIfNoSession` set to true.
*
* @return array
*/
protected function getAuthServiceConfiguration(): array
{
$configuration = parent::getAuthServiceConfiguration();

$configuration['BE_fetchUserIfNoSession'] = true;

return $configuration;
}
}
Loading
Loading