Skip to content

Commit 8b57fea

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-lynx/magento2ce into jquery-upgrade
2 parents 6814f18 + 0c14764 commit 8b57fea

File tree

108 files changed

+3804
-1639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+3804
-1639
lines changed

app/code/Magento/AsynchronousOperations/Model/AccessValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ public function isAllowed($bulkUuid)
5555
$this->bulkSummaryFactory->create(),
5656
$bulkUuid
5757
);
58-
return $bulkSummary->getUserId() === $this->userContext->getUserId();
58+
return ((int) $bulkSummary->getUserId()) === ((int) $this->userContext->getUserId());
5959
}
6060
}

app/code/Magento/Authorization/Model/CompositeUserContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function add(UserContextInterface $userContext)
6060
*/
6161
public function getUserId()
6262
{
63-
return $this->getUserContext() ? $this->getUserContext()->getUserId() : null;
63+
return $this->getUserContext() ? ((int) $this->getUserContext()->getUserId()) : null;
6464
}
6565

6666
/**

app/code/Magento/Customer/Block/Adminhtml/Form/Element/Newsletter/Subscriptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private function getSessionFormValue(string $name, int $arrayKey): ?string
152152
$data = $this->dataPersistor->get('customer_form');
153153
$currentCustomerId = $this->getData('customer_id');
154154
$sessionCustomerId = $data['customer']['entity_id'] ?? null;
155-
if ($sessionCustomerId === null || $currentCustomerId !== (int)$sessionCustomerId) {
155+
if ($sessionCustomerId === null || ((int) $currentCustomerId) !== (int)$sessionCustomerId) {
156156
return null;
157157
}
158158

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api\Data;
10+
11+
use Magento\Authorization\Model\UserContextInterface;
12+
13+
/**
14+
* User token authentication.
15+
*/
16+
class UserToken
17+
{
18+
/**
19+
* @var UserContextInterface
20+
*/
21+
private $context;
22+
23+
/**
24+
* @var UserTokenDataInterface
25+
*/
26+
private $data;
27+
28+
/**
29+
* @param UserContextInterface $context
30+
* @param UserTokenDataInterface $data
31+
*/
32+
public function __construct(UserContextInterface $context, UserTokenDataInterface $data)
33+
{
34+
$this->context = $context;
35+
$this->data = $data;
36+
}
37+
38+
public function getUserContext(): UserContextInterface
39+
{
40+
return $this->context;
41+
}
42+
43+
public function getData(): UserTokenDataInterface
44+
{
45+
return $this->data;
46+
}
47+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api\Data;
10+
11+
/**
12+
* Information attached to a user's token.
13+
*/
14+
interface UserTokenDataInterface
15+
{
16+
public function getIssued(): \DateTimeImmutable;
17+
18+
public function getExpires(): \DateTimeImmutable;
19+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api\Data;
10+
11+
use Magento\Framework\Api\ExtensibleDataInterface;
12+
13+
/**
14+
* Parameters for new tokens.
15+
*/
16+
interface UserTokenParametersInterface extends ExtensibleDataInterface
17+
{
18+
/**
19+
* Force issued timestamp as given.
20+
*
21+
* @return \DateTimeInterface|null
22+
*/
23+
public function getForcedIssuedTime(): ?\DateTimeInterface;
24+
25+
/**
26+
* @return \Magento\Integration\Api\Data\UserTokenParametersExtensionInterface|null
27+
*/
28+
public function getExtensionAttributes(): ?UserTokenParametersExtensionInterface;
29+
30+
/**
31+
* @param \Magento\Integration\Api\Data\UserTokenParametersExtensionInterface $extended
32+
*/
33+
public function setExtensionAttributes(UserTokenParametersExtensionInterface $extended): void;
34+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api\Exception;
10+
11+
use Magento\Authorization\Model\UserContextInterface;
12+
13+
/**
14+
* Describes user token related failure.
15+
*/
16+
class UserTokenException extends \InvalidArgumentException
17+
{
18+
/**
19+
* @var UserContextInterface|null
20+
*/
21+
private $context;
22+
23+
public function __construct(
24+
string $message,
25+
?\Throwable $previous = null,
26+
?UserContextInterface $forContext = null
27+
) {
28+
parent::__construct($message, 0, $previous);
29+
$this->context = $forContext;
30+
}
31+
32+
public function getUserContext(): ?UserContextInterface
33+
{
34+
return $this->context;
35+
}
36+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api;
10+
11+
use Magento\Authorization\Model\UserContextInterface;
12+
use Magento\Integration\Api\Data\UserTokenParametersInterface;
13+
use Magento\Integration\Api\Exception\UserTokenException;
14+
15+
/**
16+
* Issues tokens used to authenticate users.
17+
*/
18+
interface UserTokenIssuerInterface
19+
{
20+
/**
21+
* Create token for a user.
22+
*
23+
* @param UserContextInterface $userContext
24+
* @param UserTokenParametersInterface $params
25+
* @return string
26+
* @throws UserTokenException
27+
*/
28+
public function create(UserContextInterface $userContext, UserTokenParametersInterface $params): string;
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api;
10+
11+
use Magento\Integration\Api\Data\UserToken;
12+
use Magento\Integration\Api\Exception\UserTokenException;
13+
14+
/**
15+
* Reads user token data.
16+
*/
17+
interface UserTokenReaderInterface
18+
{
19+
/**
20+
* Read user data from a token.
21+
*
22+
* @param string $token
23+
* @return UserToken
24+
* @throws UserTokenException
25+
*/
26+
public function read(string $token): UserToken;
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api;
10+
11+
use Magento\Authorization\Model\UserContextInterface;
12+
use Magento\Integration\Api\Exception\UserTokenException;
13+
14+
/**
15+
* Revokes user tokens.
16+
*/
17+
interface UserTokenRevokerInterface
18+
{
19+
/**
20+
* Revoke all previously issued tokens for given user.
21+
*
22+
* @param UserContextInterface $userContext
23+
* @return void
24+
* @throws UserTokenException
25+
*/
26+
public function revokeFor(UserContextInterface $userContext): void;
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Integration\Api;
10+
11+
use Magento\Framework\Exception\AuthorizationException;
12+
use Magento\Integration\Api\Data\UserToken;
13+
14+
/**
15+
* Validates tokens used to authenticate users.
16+
*/
17+
interface UserTokenValidatorInterface
18+
{
19+
/**
20+
* Validate user token.
21+
*
22+
* @param UserToken $token
23+
* @throws AuthorizationException
24+
* @return void
25+
*/
26+
public function validate(UserToken $token): void;
27+
}

0 commit comments

Comments
 (0)