Skip to content
This repository was archived by the owner on May 20, 2019. It is now read-only.

Commit ccbb792

Browse files
authored
Merge pull request #1 from lfolco/2.2-develop-PR-port-17650
[Backport] Use route ID when creating secret keys in backend menus instead of route name
2 parents 2b4384c + ba5b8cb commit ccbb792

File tree

139 files changed

+2912
-496
lines changed

Some content is hidden

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

139 files changed

+2912
-496
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug report
3+
about: Technical issue with the Magento 2 core components
4+
5+
---
6+
7+
<!---
8+
Please review our guidelines before adding a new issue: https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
9+
-->
10+
11+
### Preconditions
12+
<!---
13+
Provide the exact Magento version (example: 2.2.5) and any important information on the environment where bug is reproducible.
14+
-->
15+
1.
16+
2.
17+
18+
### Steps to reproduce
19+
<!---
20+
Important: Provide a set of clear steps to reproduce this bug. We can not provide support without clear instructions on how to reproduce.
21+
-->
22+
1.
23+
2.
24+
25+
### Expected result
26+
<!--- Tell us what do you expect to happen. -->
27+
1. [Screenshots, logs or description]
28+
2.
29+
30+
### Actual result
31+
<!--- Tell us what happened instead. Include error messages and issues. -->
32+
1. [Screenshots, logs or description]
33+
2.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Developer experience issue
3+
about: Issues related to customization, extensibility, modularity
4+
5+
---
6+
7+
<!---
8+
Please review our guidelines before adding a new issue: https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
9+
-->
10+
11+
### Summary
12+
<!--- Describe the issue you are experiencing. Include general information, error messages, environments, and so on. -->
13+
14+
### Examples
15+
<!--- Provide code examples or a patch with a test (recommended) to clearly indicate the problem. -->
16+
17+
### Proposed solution
18+
<!--- Suggest your potential solutions for this issue. -->
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Feature request
3+
about: Please consider reporting directly to https://github.com/magento/community-features
4+
5+
---
6+
7+
<!---
8+
Important: This repository is intended only for Magento 2 Technical Issues. Enter Feature Requests at https://github.com/magento/community-features. Project stakeholders monitor and manage requests. Feature requests entered using this form may be moved to the forum.
9+
-->
10+
11+
### Description
12+
<!--- Describe the feature you would like to add. -->
13+
14+
### Expected behavior
15+
<!--- What is the expected behavior of this feature? How is it going to work? -->
16+
17+
### Benefits
18+
<!--- How do you think this feature would improve Magento? -->
19+
20+
### Additional information
21+
<!--- What other information can you provide about the desired feature? -->

app/bootstrap.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
// Sets default autoload mappings, may be overridden in Bootstrap::create
3232
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
3333

34-
require_once BP . '/app/functions.php';
35-
3634
/* Custom umask value may be provided in optional mage_umask file in root */
3735
$umaskFile = BP . '/magento_umask';
3836
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;

app/code/Magento/AdminNotification/etc/adminhtml/menu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
99
<menu>
10-
<add id="Magento_AdminNotification::system_adminnotification" title="Notifications" translate="title" module="Magento_AdminNotification" sortOrder="10" parent="Magento_Backend::system_other_settings" action="adminhtml/notification" resource="Magento_AdminNotification::adminnotification"/>
10+
<add id="Magento_AdminNotification::system_adminnotification" title="Notifications" translate="title" module="Magento_AdminNotification" sortOrder="10" parent="Magento_Backend::system_other_settings" action="adminhtml/notification" resource="Magento_AdminNotification::adminnotification"/>
1111
</menu>
1212
</config>

app/code/Magento/Backend/Block/Menu.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,23 @@ class Menu extends \Magento\Backend\Block\Template
7676
*/
7777
private $anchorRenderer;
7878

79+
/**
80+
* @var ConfigInterface
81+
*/
82+
private $routeConfig;
83+
7984
/**
8085
* @param Template\Context $context
8186
* @param \Magento\Backend\Model\UrlInterface $url
8287
* @param \Magento\Backend\Model\Menu\Filter\IteratorFactory $iteratorFactory
8388
* @param \Magento\Backend\Model\Auth\Session $authSession
8489
* @param \Magento\Backend\Model\Menu\Config $menuConfig
8590
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
91+
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
8692
* @param array $data
8793
* @param MenuItemChecker|null $menuItemChecker
8894
* @param AnchorRenderer|null $anchorRenderer
95+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8996
*/
9097
public function __construct(
9198
\Magento\Backend\Block\Template\Context $context,
@@ -96,7 +103,8 @@ public function __construct(
96103
\Magento\Framework\Locale\ResolverInterface $localeResolver,
97104
array $data = [],
98105
MenuItemChecker $menuItemChecker = null,
99-
AnchorRenderer $anchorRenderer = null
106+
AnchorRenderer $anchorRenderer = null,
107+
\Magento\Framework\App\Route\ConfigInterface $routeConfig = null
100108
) {
101109
$this->_url = $url;
102110
$this->_iteratorFactory = $iteratorFactory;
@@ -105,6 +113,9 @@ public function __construct(
105113
$this->_localeResolver = $localeResolver;
106114
$this->menuItemChecker = $menuItemChecker;
107115
$this->anchorRenderer = $anchorRenderer;
116+
$this->routeConfig = $routeConfig ?:
117+
\Magento\Framework\App\ObjectManager::getInstance()
118+
->get(\Magento\Framework\App\Route\ConfigInterface::class);
108119
parent::__construct($context, $data);
109120
}
110121

@@ -203,8 +214,9 @@ protected function _afterToHtml($html)
203214
*/
204215
protected function _callbackSecretKey($match)
205216
{
217+
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
206218
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
207-
$match[0],
219+
$routeId,
208220
$match[2],
209221
$match[3]
210222
);

app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ $numColumns = sizeof($block->getColumns());
107107
<?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?>
108108
</label>
109109
<?php if ($_curPage < $_lastPage): ?>
110-
<button title="<?= /* @escapeNotVerified */ __('Next page') ?>"
110+
<button type="button" title="<?= /* @escapeNotVerified */ __('Next page') ?>"
111111
class="action-next"
112112
onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;">
113113
<span><?= /* @escapeNotVerified */ __('Next page') ?></span>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOrderFillBraintreeCreditCardActionGroup">
11+
<arguments>
12+
<argument name="cardData" defaultValue="BraintreeCard"/>
13+
</arguments>
14+
<waitForLoadingMaskToDisappear stepKey="waitLoadingMaskDisappear"/>
15+
<conditionalClick selector="{{AdminOrderFormPaymentSection.braintreeCreditCardMethod}}" dependentSelector="{{AdminOrderFormPaymentSection.braintreeCreditCardMethod}}" visible="true" stepKey="chooseBraintreeCreditCard"/>
16+
<waitForLoadingMaskToDisappear stepKey="waitLoadingMask"/>
17+
<selectOption selector="{{AdminOrderFormPaymentSection.braintreeCcType}}" userInput="{{cardData.cc_type}}" stepKey="fillCc"/>
18+
<!--Fill card number-->
19+
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcFrame}}" stepKey="switchToCcIFrame"/>
20+
<fillField selector="{{AdminOrderFormPaymentSection.braintreeCardNumber}}" userInput="{{cardData.card_number}}" stepKey="fillCardNumber"/>
21+
<waitForPageLoad stepKey="waitForFillCardNumber" time="1"/>
22+
<switchToIFrame stepKey="switchToDefaultContext1"/>
23+
<!--Fill card expiration month-->
24+
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcExpMonthFrame}}" stepKey="switchToCcExpMonthIFrame"/>
25+
<fillField selector="{{AdminOrderFormPaymentSection.braintreeExpMonth}}" userInput="{{cardData.exp_month}}" stepKey="fillExpMonth"/>
26+
<waitForPageLoad stepKey="waitForFillCardExpMonth" time="1"/>
27+
<switchToIFrame stepKey="switchToDefaultContext2"/>
28+
<!--Fill card expiration year-->
29+
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcExpYear}}" stepKey="switchToCcExpYearIFrame"/>
30+
<fillField selector="{{AdminOrderFormPaymentSection.braintreeExpYear}}" userInput="{{cardData.exp_year}}" stepKey="fillExpYear"/>
31+
<waitForPageLoad stepKey="waitForFillCardExpYear" time="1"/>
32+
<switchToIFrame stepKey="switchToDefaultContext3"/>
33+
<!--Fill card CVV-->
34+
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCvvFrame}}" stepKey="switchToCvvIFrame"/>
35+
<fillField selector="{{AdminOrderFormPaymentSection.braintreeCvv}}" userInput="{{cardData.cvv}}" stepKey="fillCvv"/>
36+
<waitForPageLoad stepKey="waitForFillCardCvv" time="1"/>
37+
<switchToIFrame stepKey="switchToDefaultContext4"/>
38+
</actionGroup>
39+
</actionGroups>

app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@
4343
<requiredEntity type="merchant_id">DefaultMerchantId</requiredEntity>
4444
<requiredEntity type="public_key">DefaultPublicKey</requiredEntity>
4545
<requiredEntity type="private_key">DefaultPrivateKey</requiredEntity>
46+
<requiredEntity type="active">DefaultActive</requiredEntity>
47+
<requiredEntity type="merchant_account_id">DefaultMerchantAccountId</requiredEntity>
4648
</entity>
4749
<entity name="DefaultTitle" type="title">
4850
<data key="value"/>
4951
</entity>
5052
<entity name="DefaultPaymentAction" type="payment_action">
51-
<data key="value"/>
53+
<data key="value">authorize</data>
5254
</entity>
5355
<entity name="DefaultEnvironment" type="environment">
54-
<data key="value"/>
56+
<data key="value">sandbox</data>
5557
</entity>
5658
<entity name="DefaultMerchantId" type="merchant_id">
5759
<data key="value"/>
@@ -62,4 +64,54 @@
6264
<entity name="DefaultPrivateKey" type="private_key">
6365
<data key="value"/>
6466
</entity>
67+
<entity name="DefaultActive" type="active">
68+
<data key="value">0</data>
69+
</entity>
70+
<entity name="DefaultMerchantAccountId" type="merchant_account_id">
71+
<data key="value"/>
72+
</entity>
73+
74+
<entity name="SandboxBraintreeConfig" type="braintree_config_state">
75+
<requiredEntity type="title">EnabledTitle</requiredEntity>
76+
<requiredEntity type="payment_action">AuthorizePaymentAction</requiredEntity>
77+
<requiredEntity type="environment">SandboxEnvironment</requiredEntity>
78+
<requiredEntity type="merchant_id">EnabledMerchantId</requiredEntity>
79+
<requiredEntity type="public_key">EnabledPublicKey</requiredEntity>
80+
<requiredEntity type="private_key">EnabledPrivateKey</requiredEntity>
81+
<requiredEntity type="active">EnabledActive</requiredEntity>
82+
<requiredEntity type="merchant_account_id">EnabledMerchantAccountId</requiredEntity>
83+
</entity>
84+
<entity name="EnabledTitle" type="title">
85+
<data key="value">Credit Card (Braintree)</data>
86+
</entity>
87+
<entity name="AuthorizePaymentAction" type="payment_action">
88+
<data key="value">authorize</data>
89+
</entity>
90+
<entity name="SandboxEnvironment" type="environment">
91+
<data key="value">sandbox</data>
92+
</entity>
93+
<entity name="EnabledMerchantId" type="merchant_id">
94+
<data key="value">d4pdjhxgjfrsmzbf</data>
95+
</entity>
96+
<entity name="EnabledPublicKey" type="public_key">
97+
<data key="value">m7q4wmh43xrgyrst</data>
98+
</entity>
99+
<entity name="EnabledPrivateKey" type="private_key">
100+
<data key="value">67de364080b1b4e2492d7a3de413a572</data>
101+
</entity>
102+
<entity name="EnabledActive" type="active">
103+
<data key="value">1</data>
104+
</entity>
105+
<entity name="EnabledMerchantAccountId" type="merchant_account_id">
106+
<data key="value">Magneto</data>
107+
</entity>
108+
109+
<entity name="BraintreeCard" type="creditCard">
110+
<data key="cc_type">MasterCard</data>
111+
<data key="card_number">5105105105105100</data>
112+
<data key="exp_month">12</data>
113+
<data key="exp_year">20</data>
114+
<data key="cvv">113</data>
115+
</entity>
116+
65117
</entities>

app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
11-
<operation name="CreateBraintreeConfigState" dataType="braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
11+
<operation name="CreateBraintreeConfigState" dataType="braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" successRegex="/messages-message-success/" method="POST">
12+
<contentType>application/x-www-form-urlencoded</contentType>
1213
<object key="groups" dataType="braintree_config_state">
1314
<object key="braintree_section" dataType="braintree_config_state">
1415
<object key="groups" dataType="braintree_config_state">
@@ -36,6 +37,18 @@
3637
</object>
3738
</object>
3839
</object>
40+
<object key="braintree_advanced" dataType="braintree_config_state">
41+
<object key="fields" dataType="braintree_config_state">
42+
<object key="merchant_account_id" dataType="merchant_account_id">
43+
<field key="value">string</field>
44+
</object>
45+
</object>
46+
</object>
47+
</object>
48+
<object key="fields" dataType="braintree_config_state">
49+
<object key="active" dataType="active">
50+
<field key="value">integer</field>
51+
</object>
3952
</object>
4053
</object>
4154
</object>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminOrderFormPaymentSection">
12+
<element name="braintreeCreditCardMethod" type="radio" selector="#p_method_braintree" timeout="10"/>
13+
<element name="braintreeCcType" type="select" selector="#braintree_cc_type"/>
14+
<element name="braintreeCardNumber" type="input" selector="#credit-card-number"/>
15+
<element name="braintreeExpMonth" type="input" selector="#expiration-month"/>
16+
<element name="braintreeExpYear" type="input" selector="#expiration-year"/>
17+
<element name="braintreeCvv" type="input" selector="#cvv"/>
18+
<element name="braintreeCcFrame" type="iframe" selector="braintree-hosted-field-number"/>
19+
<element name="braintreeCcExpMonthFrame" type="iframe" selector="braintree-hosted-field-expirationMonth"/>
20+
<element name="braintreeCcExpYear" type="iframe" selector="braintree-hosted-field-expirationYear"/>
21+
<element name="braintreeCvvFrame" type="iframe" selector="braintree-hosted-field-cvv"/>
22+
</section>
23+
</sections>

0 commit comments

Comments
 (0)