Skip to content

Commit 13194b6

Browse files
committed
Merge remote-tracking branch 'performance/CABPI-425' into CABPI-398
2 parents a8838d6 + 8f846ba commit 13194b6

File tree

145 files changed

+2989
-885
lines changed

Some content is hidden

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

145 files changed

+2989
-885
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Bug report
2+
description: Technical issue with the Magento 2 core components
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Please read [our guidelines](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#report-an-issue) before submitting the issue.
8+
- type: textarea
9+
attributes:
10+
label: Preconditions and environment
11+
description: |
12+
Describe your environment.
13+
Provide all the details that will help us to reproduce the bug.
14+
value: |
15+
- Magento version
16+
- Anything else that would help a developer reproduce the bug
17+
- type: textarea
18+
attributes:
19+
label: Steps to reproduce
20+
description: |
21+
Provide a set of clear steps to reproduce this bug.
22+
placeholder: |
23+
Example:
24+
1. Navigate to storefront as a guest.
25+
2. Open Test Category.
26+
3. Click “Add to Cart” on the Virtual Product.
27+
4. Open mini shopping cart and click “Proceed to Checkout”.
28+
validations:
29+
required: true
30+
- type: textarea
31+
attributes:
32+
label: Expected result
33+
description: |
34+
Tell us what you expected to happen.
35+
placeholder: |
36+
Example:
37+
Order is placed successfully, customer is redirected to the success page.
38+
validations:
39+
required: true
40+
- type: textarea
41+
attributes:
42+
label: Actual result
43+
description: |
44+
Tell us what happened. Include error messages and issues.
45+
placeholder: |
46+
Example:
47+
“Place order” button is not visible, order cannot be placed.
48+
validations:
49+
required: true
50+
- type: textarea
51+
attributes:
52+
label: Additional information
53+
description: |
54+
Additional information is often requested when the bug report is processed. You can save time by providing both Magento and browser logs, screenshots, repository branch and HEAD commit you checked out to install Magento and any other artifacts related to the issue.
55+
Also, links to the comments with important information, Root Cause analysis, additional video recordings; and anything else that is important for the issue and at some reason cannot be added to other sections.
56+
- type: textarea
57+
attributes:
58+
label: Release note
59+
description: |
60+
Help us to provide meaningful release notes to the community.
61+
- type: checkboxes
62+
attributes:
63+
label: Triage and priority
64+
description: |
65+
Provide [Severity](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#community-backlog-priority) assessment for the Issue as a Reporter.
66+
This information helps us during the Confirmation and Issue triage processes.
67+
options:
68+
- label: 'Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._'
69+
- label: 'Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._'
70+
- label: 'Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._'
71+
- label: 'Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._'
72+
- label: 'Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._'

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Magento values the contributions of the security research community, and we look
44

55
## Where should I report security issues?
66

7-
We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/magento). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps.
7+
We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/adobe). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps.
88

99
## Learning More About Security
1010
To learn more about securing a Magento store, please visit the [Security Center](https://magento.com/security).

app/code/Magento/AdminAdobeIms/Api/Data/ImsWebapiInterface.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function setAccessTokenExpiresAt(string $value): ImsWebapiInterface;
131131
/**
132132
* Retrieve existing extension attributes object or create a new one.
133133
*
134-
* @return \Magento\AdminAdobeIms\Api\Data\ImsWebapiExtensionInterface
134+
* @return \Magento\AdminAdobeIms\Api\Data\ImsWebapiExtensionInterface|null
135135
*/
136136
public function getExtensionAttributes(): ImsWebapiExtensionInterface;
137137

@@ -141,7 +141,5 @@ public function getExtensionAttributes(): ImsWebapiExtensionInterface;
141141
* @param \Magento\AdminAdobeIms\Api\Data\ImsWebapiExtensionInterface $extensionAttributes
142142
* @return $this
143143
*/
144-
public function setExtensionAttributes(
145-
ImsWebapiExtensionInterface $extensionAttributes
146-
): ImsWebapiInterface;
144+
public function setExtensionAttributes(ImsWebapiExtensionInterface $extensionAttributes): ImsWebapiInterface;
147145
}

app/code/Magento/AdminAdobeIms/Controller/Adminhtml/OAuth/ImsCallback.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ public function execute(): Redirect
102102
$tokenResponse = $this->adminImsConnection->getTokenResponse($code);
103103
$accessToken = $tokenResponse->getAccessToken();
104104

105-
//check organization assignment
106-
$this->adminOrganizationService->checkOrganizationAllocation($accessToken);
107-
108105
//get profile info to check email
109106
$profile = $this->adminImsConnection->getProfile($accessToken);
110107
if (empty($profile['email'])) {
111108
throw new AuthenticationException(__('An authentication error occurred. Verify and try again.'));
112109
}
110+
111+
//check membership in organization
112+
$this->adminOrganizationService->checkOrganizationMembership($accessToken);
113+
113114
$this->adminLoginProcessService->execute($tokenResponse, $profile);
114115
} catch (AdobeImsAuthorizationException $e) {
115116
$this->logger->error($e->getMessage());

app/code/Magento/AdminAdobeIms/Controller/Adminhtml/OAuth/ImsReauthCallback.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ public function execute(): ResultInterface
118118
}
119119

120120
$tokenResponse = $this->adminImsConnection->getTokenResponse($code);
121+
$accessToken = $tokenResponse->getAccessToken();
121122

122-
$profile = $this->adminImsConnection->getProfile($tokenResponse->getAccessToken());
123+
$profile = $this->adminImsConnection->getProfile($accessToken);
123124
if (empty($profile['email'])) {
124125
throw new AuthenticationException(__('An authentication error occurred. Verify and try again.'));
125126
}
126127

127-
$accessToken = $tokenResponse->getAccessToken();
128-
$this->adminOrganizationService->checkOrganizationAllocation($accessToken);
128+
//check membership in organization
129+
$this->adminOrganizationService->checkOrganizationMembership($accessToken);
130+
129131
$this->adminReauthProcessService->execute($tokenResponse);
130132

131133
$response = sprintf(
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab;
10+
11+
use Magento\AdminAdobeIms\Plugin\AdobeImsReauth\AddAdobeImsReAuthButton;
12+
use Magento\AdminAdobeIms\Service\ImsConfig;
13+
use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info;
14+
15+
class AddReAuthVerification
16+
{
17+
/**
18+
* @var AddAdobeImsReAuthButton
19+
*/
20+
private AddAdobeImsReAuthButton $adobeImsReAuthButton;
21+
22+
/**
23+
* @var ImsConfig
24+
*/
25+
private ImsConfig $adminAdobeImsConfig;
26+
27+
/**
28+
* @param AddAdobeImsReAuthButton $adobeImsReAuthButton
29+
* @param ImsConfig $adminAdobeImsConfig
30+
*/
31+
public function __construct(
32+
AddAdobeImsReAuthButton $adobeImsReAuthButton,
33+
ImsConfig $adminAdobeImsConfig
34+
) {
35+
$this->adobeImsReAuthButton = $adobeImsReAuthButton;
36+
$this->adminAdobeImsConfig = $adminAdobeImsConfig;
37+
}
38+
39+
/**
40+
* Add adobeIms reAuth button to integration new/edit form
41+
*
42+
* @param Info $subject
43+
* @return void
44+
*/
45+
public function beforeGetFormHtml(Info $subject): void
46+
{
47+
if ($this->adminAdobeImsConfig->enabled()) {
48+
$form = $subject->getForm();
49+
if (is_object($form)) {
50+
$verificationFieldset = $form->getElement('current_user_verification_fieldset');
51+
if ($verificationFieldset !== null) {
52+
$this->adobeImsReAuthButton->addAdobeImsReAuthButton($verificationFieldset);
53+
$subject->setForm($form);
54+
}
55+
}
56+
}
57+
}
58+
}

app/code/Magento/AdminAdobeIms/Plugin/ResetAttemptForBackendObserverPlugin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ public function __construct(ImsConfig $adminImsConfig)
3333
* @param ResetAttemptForBackendObserver $subject
3434
* @param callable $proceed
3535
* @param Observer $observer
36+
* @return void
3637
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3738
*/
38-
public function aroundExecute(ResetAttemptForBackendObserver $subject, callable $proceed, Observer $observer)
39+
public function aroundExecute(ResetAttemptForBackendObserver $subject, callable $proceed, Observer $observer): void
3940
{
4041
if (!$this->adminImsConfig->enabled()) {
41-
return $proceed($observer);
42+
$proceed($observer);
4243
}
4344
}
4445
}

app/code/Magento/AdminAdobeIms/Service/AbstractAdminBaseProcessService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ abstract class AbstractAdminBaseProcessService
3030
protected Auth $auth;
3131

3232
/**
33-
* @var LogOut
33+
* @var DateTime
3434
*/
35-
protected LogOut $logOut;
35+
protected DateTime $dateTime;
3636

3737
/**
38-
* @var DateTime
38+
* @var LogOut
3939
*/
40-
protected DateTime $dateTime;
40+
private LogOut $logOut;
4141

4242
/**
4343
* @param User $adminUser

app/code/Magento/AdminAdobeIms/Service/ImsConfig.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ImsConfig extends Config
3434
public const XML_PATH_ADMIN_AUTH_URL_PATTERN = 'adobe_ims/integration/admin/auth_url_pattern';
3535
public const XML_PATH_ADMIN_REAUTH_URL_PATTERN = 'adobe_ims/integration/admin/reauth_url_pattern';
3636
public const XML_PATH_ADMIN_ADOBE_IMS_SCOPES = 'adobe_ims/integration/admin/scopes';
37+
public const XML_PATH_ORGANIZATION_MEMBERSHIP_URL = 'adobe_ims/integration/organization_membership_url';
3738

3839
private const OAUTH_CALLBACK_URL = 'adobe_ims_auth/oauth/';
3940

@@ -376,4 +377,19 @@ public function getCertificateUrl(string $fileName): string
376377
{
377378
return $this->scopeConfig->getValue(self::XML_PATH_CERTIFICATE_PATH) . $fileName;
378379
}
380+
381+
/**
382+
* Get url to check organization membership
383+
*
384+
* @param string $orgId
385+
* @return string
386+
*/
387+
public function getOrganizationMembershipUrl(string $orgId): string
388+
{
389+
return str_replace(
390+
['#{org_id}'],
391+
[$orgId],
392+
$this->scopeConfig->getValue(self::XML_PATH_ORGANIZATION_MEMBERSHIP_URL)
393+
);
394+
}
379395
}

0 commit comments

Comments
 (0)