Skip to content

Commit

Permalink
Merge pull request #1 from lfolco/2.2-develop-PR-port-17650
Browse files Browse the repository at this point in the history
[Backport] Use route ID when creating secret keys in backend menus instead of route name
  • Loading branch information
lfolco authored Sep 11, 2018
2 parents 2b4384c + ba5b8cb commit ccbb792
Show file tree
Hide file tree
Showing 139 changed files with 2,912 additions and 496 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Technical issue with the Magento 2 core components

---

<!---
Please review our guidelines before adding a new issue: https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
-->

### Preconditions
<!---
Provide the exact Magento version (example: 2.2.5) and any important information on the environment where bug is reproducible.
-->
1.
2.

### Steps to reproduce
<!---
Important: Provide a set of clear steps to reproduce this bug. We can not provide support without clear instructions on how to reproduce.
-->
1.
2.

### Expected result
<!--- Tell us what do you expect to happen. -->
1. [Screenshots, logs or description]
2.

### Actual result
<!--- Tell us what happened instead. Include error messages and issues. -->
1. [Screenshots, logs or description]
2.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/developer-experience-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Developer experience issue
about: Issues related to customization, extensibility, modularity

---

<!---
Please review our guidelines before adding a new issue: https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
-->

### Summary
<!--- Describe the issue you are experiencing. Include general information, error messages, environments, and so on. -->

### Examples
<!--- Provide code examples or a patch with a test (recommended) to clearly indicate the problem. -->

### Proposed solution
<!--- Suggest your potential solutions for this issue. -->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature request
about: Please consider reporting directly to https://github.com/magento/community-features

---

<!---
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.
-->

### Description
<!--- Describe the feature you would like to add. -->

### Expected behavior
<!--- What is the expected behavior of this feature? How is it going to work? -->

### Benefits
<!--- How do you think this feature would improve Magento? -->

### Additional information
<!--- What other information can you provide about the desired feature? -->
2 changes: 0 additions & 2 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

require_once BP . '/app/functions.php';

/* Custom umask value may be provided in optional mage_umask file in root */
$umaskFile = BP . '/magento_umask';
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/etc/adminhtml/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<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"/>
<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"/>
</menu>
</config>
16 changes: 14 additions & 2 deletions app/code/Magento/Backend/Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,23 @@ class Menu extends \Magento\Backend\Block\Template
*/
private $anchorRenderer;

/**
* @var ConfigInterface
*/
private $routeConfig;

/**
* @param Template\Context $context
* @param \Magento\Backend\Model\UrlInterface $url
* @param \Magento\Backend\Model\Menu\Filter\IteratorFactory $iteratorFactory
* @param \Magento\Backend\Model\Auth\Session $authSession
* @param \Magento\Backend\Model\Menu\Config $menuConfig
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
* @param array $data
* @param MenuItemChecker|null $menuItemChecker
* @param AnchorRenderer|null $anchorRenderer
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
Expand All @@ -96,7 +103,8 @@ public function __construct(
\Magento\Framework\Locale\ResolverInterface $localeResolver,
array $data = [],
MenuItemChecker $menuItemChecker = null,
AnchorRenderer $anchorRenderer = null
AnchorRenderer $anchorRenderer = null,
\Magento\Framework\App\Route\ConfigInterface $routeConfig = null
) {
$this->_url = $url;
$this->_iteratorFactory = $iteratorFactory;
Expand All @@ -105,6 +113,9 @@ public function __construct(
$this->_localeResolver = $localeResolver;
$this->menuItemChecker = $menuItemChecker;
$this->anchorRenderer = $anchorRenderer;
$this->routeConfig = $routeConfig ?:
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\App\Route\ConfigInterface::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -203,8 +214,9 @@ protected function _afterToHtml($html)
*/
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$match[0],
$routeId,
$match[2],
$match[3]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $numColumns = sizeof($block->getColumns());
<?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?>
</label>
<?php if ($_curPage < $_lastPage): ?>
<button title="<?= /* @escapeNotVerified */ __('Next page') ?>"
<button type="button" title="<?= /* @escapeNotVerified */ __('Next page') ?>"
class="action-next"
onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;">
<span><?= /* @escapeNotVerified */ __('Next page') ?></span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOrderFillBraintreeCreditCardActionGroup">
<arguments>
<argument name="cardData" defaultValue="BraintreeCard"/>
</arguments>
<waitForLoadingMaskToDisappear stepKey="waitLoadingMaskDisappear"/>
<conditionalClick selector="{{AdminOrderFormPaymentSection.braintreeCreditCardMethod}}" dependentSelector="{{AdminOrderFormPaymentSection.braintreeCreditCardMethod}}" visible="true" stepKey="chooseBraintreeCreditCard"/>
<waitForLoadingMaskToDisappear stepKey="waitLoadingMask"/>
<selectOption selector="{{AdminOrderFormPaymentSection.braintreeCcType}}" userInput="{{cardData.cc_type}}" stepKey="fillCc"/>
<!--Fill card number-->
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcFrame}}" stepKey="switchToCcIFrame"/>
<fillField selector="{{AdminOrderFormPaymentSection.braintreeCardNumber}}" userInput="{{cardData.card_number}}" stepKey="fillCardNumber"/>
<waitForPageLoad stepKey="waitForFillCardNumber" time="1"/>
<switchToIFrame stepKey="switchToDefaultContext1"/>
<!--Fill card expiration month-->
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcExpMonthFrame}}" stepKey="switchToCcExpMonthIFrame"/>
<fillField selector="{{AdminOrderFormPaymentSection.braintreeExpMonth}}" userInput="{{cardData.exp_month}}" stepKey="fillExpMonth"/>
<waitForPageLoad stepKey="waitForFillCardExpMonth" time="1"/>
<switchToIFrame stepKey="switchToDefaultContext2"/>
<!--Fill card expiration year-->
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCcExpYear}}" stepKey="switchToCcExpYearIFrame"/>
<fillField selector="{{AdminOrderFormPaymentSection.braintreeExpYear}}" userInput="{{cardData.exp_year}}" stepKey="fillExpYear"/>
<waitForPageLoad stepKey="waitForFillCardExpYear" time="1"/>
<switchToIFrame stepKey="switchToDefaultContext3"/>
<!--Fill card CVV-->
<switchToIFrame selector="{{AdminOrderFormPaymentSection.braintreeCvvFrame}}" stepKey="switchToCvvIFrame"/>
<fillField selector="{{AdminOrderFormPaymentSection.braintreeCvv}}" userInput="{{cardData.cvv}}" stepKey="fillCvv"/>
<waitForPageLoad stepKey="waitForFillCardCvv" time="1"/>
<switchToIFrame stepKey="switchToDefaultContext4"/>
</actionGroup>
</actionGroups>
56 changes: 54 additions & 2 deletions app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@
<requiredEntity type="merchant_id">DefaultMerchantId</requiredEntity>
<requiredEntity type="public_key">DefaultPublicKey</requiredEntity>
<requiredEntity type="private_key">DefaultPrivateKey</requiredEntity>
<requiredEntity type="active">DefaultActive</requiredEntity>
<requiredEntity type="merchant_account_id">DefaultMerchantAccountId</requiredEntity>
</entity>
<entity name="DefaultTitle" type="title">
<data key="value"/>
</entity>
<entity name="DefaultPaymentAction" type="payment_action">
<data key="value"/>
<data key="value">authorize</data>
</entity>
<entity name="DefaultEnvironment" type="environment">
<data key="value"/>
<data key="value">sandbox</data>
</entity>
<entity name="DefaultMerchantId" type="merchant_id">
<data key="value"/>
Expand All @@ -62,4 +64,54 @@
<entity name="DefaultPrivateKey" type="private_key">
<data key="value"/>
</entity>
<entity name="DefaultActive" type="active">
<data key="value">0</data>
</entity>
<entity name="DefaultMerchantAccountId" type="merchant_account_id">
<data key="value"/>
</entity>

<entity name="SandboxBraintreeConfig" type="braintree_config_state">
<requiredEntity type="title">EnabledTitle</requiredEntity>
<requiredEntity type="payment_action">AuthorizePaymentAction</requiredEntity>
<requiredEntity type="environment">SandboxEnvironment</requiredEntity>
<requiredEntity type="merchant_id">EnabledMerchantId</requiredEntity>
<requiredEntity type="public_key">EnabledPublicKey</requiredEntity>
<requiredEntity type="private_key">EnabledPrivateKey</requiredEntity>
<requiredEntity type="active">EnabledActive</requiredEntity>
<requiredEntity type="merchant_account_id">EnabledMerchantAccountId</requiredEntity>
</entity>
<entity name="EnabledTitle" type="title">
<data key="value">Credit Card (Braintree)</data>
</entity>
<entity name="AuthorizePaymentAction" type="payment_action">
<data key="value">authorize</data>
</entity>
<entity name="SandboxEnvironment" type="environment">
<data key="value">sandbox</data>
</entity>
<entity name="EnabledMerchantId" type="merchant_id">
<data key="value">d4pdjhxgjfrsmzbf</data>
</entity>
<entity name="EnabledPublicKey" type="public_key">
<data key="value">m7q4wmh43xrgyrst</data>
</entity>
<entity name="EnabledPrivateKey" type="private_key">
<data key="value">67de364080b1b4e2492d7a3de413a572</data>
</entity>
<entity name="EnabledActive" type="active">
<data key="value">1</data>
</entity>
<entity name="EnabledMerchantAccountId" type="merchant_account_id">
<data key="value">Magneto</data>
</entity>

<entity name="BraintreeCard" type="creditCard">
<data key="cc_type">MasterCard</data>
<data key="card_number">5105105105105100</data>
<data key="exp_month">12</data>
<data key="exp_year">20</data>
<data key="cvv">113</data>
</entity>

</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
<operation name="CreateBraintreeConfigState" dataType="braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
<operation name="CreateBraintreeConfigState" dataType="braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" successRegex="/messages-message-success/" method="POST">
<contentType>application/x-www-form-urlencoded</contentType>
<object key="groups" dataType="braintree_config_state">
<object key="braintree_section" dataType="braintree_config_state">
<object key="groups" dataType="braintree_config_state">
Expand Down Expand Up @@ -36,6 +37,18 @@
</object>
</object>
</object>
<object key="braintree_advanced" dataType="braintree_config_state">
<object key="fields" dataType="braintree_config_state">
<object key="merchant_account_id" dataType="merchant_account_id">
<field key="value">string</field>
</object>
</object>
</object>
</object>
<object key="fields" dataType="braintree_config_state">
<object key="active" dataType="active">
<field key="value">integer</field>
</object>
</object>
</object>
</object>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminOrderFormPaymentSection">
<element name="braintreeCreditCardMethod" type="radio" selector="#p_method_braintree" timeout="10"/>
<element name="braintreeCcType" type="select" selector="#braintree_cc_type"/>
<element name="braintreeCardNumber" type="input" selector="#credit-card-number"/>
<element name="braintreeExpMonth" type="input" selector="#expiration-month"/>
<element name="braintreeExpYear" type="input" selector="#expiration-year"/>
<element name="braintreeCvv" type="input" selector="#cvv"/>
<element name="braintreeCcFrame" type="iframe" selector="braintree-hosted-field-number"/>
<element name="braintreeCcExpMonthFrame" type="iframe" selector="braintree-hosted-field-expirationMonth"/>
<element name="braintreeCcExpYear" type="iframe" selector="braintree-hosted-field-expirationYear"/>
<element name="braintreeCvvFrame" type="iframe" selector="braintree-hosted-field-cvv"/>
</section>
</sections>
Loading

0 comments on commit ccbb792

Please sign in to comment.