Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/main/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostiantyn Poida committed Jan 14, 2015
2 parents c812a4e + 6e6e2af commit 2f31add
Show file tree
Hide file tree
Showing 88 changed files with 544 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@

$installer->startSetup();

if ($installer->getConnection()->isTableExists($installer->getTable('admin_role'))) {
/**
* Rename existing 'admin_role' table into 'authorization_role' (to avoid forcing Magento re-installation)
* TODO: This conditional logic can be removed some time after pull request is delivered to the mainline
*/
$installer->getConnection()->renameTable(
$installer->getTable('admin_role'),
$installer->getTable('authorization_role')
);
} elseif (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) {
if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) {
/**
* Create table 'authorization_role'
*/
Expand Down Expand Up @@ -84,16 +75,7 @@
$installer->getConnection()->createTable($table);
}

if ($installer->getConnection()->isTableExists($installer->getTable('admin_rule'))) {
/**
* Rename existing 'admin_rule' table into 'authorization_rule' (to avoid forcing Magento re-installation)
* TODO: This conditional logic can be removed some time after pull request is delivered to the mainline
*/
$installer->getConnection()->renameTable(
$installer->getTable('admin_rule'),
$installer->getTable('authorization_rule')
);
} elseif (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) {
if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) {
/**
* Create table 'authorization_rule'
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ public function execute()

if ($this->_objectManager->get('Magento\Framework\Locale\Validator')->isValid($interfaceLocale)) {
$user->setInterfaceLocale($interfaceLocale);
$this->_objectManager->get(
'Magento\Backend\Model\Locale\Manager'
)->switchBackendInterfaceLocale(
$interfaceLocale
);
/** @var \Magento\Backend\Model\Locale\Manager $localeManager */
$localeManager = $this->_objectManager->get('Magento\Backend\Model\Locale\Manager');
$localeManager->switchBackendInterfaceLocale($interfaceLocale);
}
/** Before updating admin user data, ensure that password of current admin user is entered and is correct */
$currentUserPasswordField = \Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD;
Expand All @@ -75,7 +73,10 @@ public function execute()
$user->setPasswordConfirmation($passwordConfirmation);
}
$user->save();
$user->sendPasswordResetNotificationEmail();
/** Send password reset email notification only when password was changed */
if ($password !== '') {
$user->sendPasswordResetNotificationEmail();
}
$this->messageManager->addSuccess(__('The account has been saved.'));
} catch (\Magento\Framework\Model\Exception $e) {
$this->messageManager->addMessages($e->getMessages());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ public function execute()
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath(
'adminhtml/system_config/edit',
['_current' => ['section', 'website', 'store']]
[
'_current' => ['section', 'website', 'store'],
'_nosid' => true
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/
namespace Magento\Catalog\Model\Product\Media;

use \Magento\Catalog\Api\ProductMediaAttributeManagementInterface;
use \Magento\Store\Model\StoreManagerInterface;
use \Magento\Catalog\Model\Product;
use Magento\Catalog\Api\ProductMediaAttributeManagementInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Model\Product;

class AttributeManagement implements ProductMediaAttributeManagementInterface
{
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Catalog/etc/webapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<resource ref="Magento_Catalog::products" />
</resources>
</route>
<route url="/V1/products" method="PUT">
<route url="/V1/products" method="GET">
<service class="Magento\Catalog\Api\ProductRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Catalog::products" />
Expand All @@ -52,7 +52,7 @@
<resource ref="Magento_Catalog::attributes_attributes" />
</resources>
</route>
<route url="/V1/products/attributes" method="PUT">
<route url="/V1/products/attributes" method="GET">
<service class="Magento\Catalog\Api\ProductAttributeRepositoryInterface" method="getList" />
<resources>
<resource ref="Magento_Catalog::attributes_attributes" />
Expand All @@ -64,7 +64,7 @@
<resource ref="Magento_Catalog::attributes_attributes" />
</resources>
</route>
<route url="/V1/categories/attributes" method="PUT">
<route url="/V1/categories/attributes" method="GET">
<service class="Magento\Catalog\Api\CategoryAttributeRepositoryInterface" method="getList" />
<resources>
<resource ref="Magento_Catalog::attributes_attributes" />
Expand Down Expand Up @@ -100,7 +100,7 @@
<resource ref="Magento_Catalog::products"/>
</resources>
</route>
<route url="/V1/products/attribute-sets/sets/list" method="PUT">
<route url="/V1/products/attribute-sets/sets/list" method="GET">
<service class="Magento\Catalog\Api\AttributeSetRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Catalog::sets"/>
Expand Down Expand Up @@ -148,7 +148,7 @@
<resource ref="Magento_Catalog::sets"/>
</resources>
</route>
<route url="/V1/products/attribute-sets/groups/list" method="PUT">
<route url="/V1/products/attribute-sets/groups/list" method="GET">
<service class="Magento\Catalog\Api\ProductAttributeGroupRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Catalog::sets"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
use \Magento\Catalog\Model\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<?php if ($this->getCollection()->getSize()): ?>
<div class="toolbar toolbar-products" data-mage-init='<?php echo $this->getWidgetOptionsJson(); ?>'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
use \Magento\Catalog\Model\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<p class="toolbar-amount">
<?php if ($this->getLastPageNum() > 1): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
use \Magento\Catalog\Model\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<div class="field limiter">
<label class="label" for="limiter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
use \Magento\Catalog\Model\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<div class="toolbar-sorter sorter">
<label class="sorter-label" for="sorter"><?php echo __('Sort By') ?></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
use \Magento\Catalog\Model\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<?php if ($this->isEnabledViewSwitcher()): ?>
<div class="modes">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use Magento\Catalog\Model\Category;
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
use \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider;
use Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider;

class Move
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
*/
namespace Magento\Checkout\Service\V1\PaymentMethod;

use \Magento\Sales\Model\QuoteRepository;
use \Magento\Store\Model\StoreManagerInterface;
use Magento\Sales\Model\QuoteRepository;
use Magento\Checkout\Service\V1\Data\Cart\PaymentMethod\Converter as QuoteMethodConverter;
use Magento\Checkout\Service\V1\Data\PaymentMethod\Converter as PaymentMethodConverter;
use \Magento\Payment\Model\MethodList;
use Magento\Payment\Model\MethodList;

/**
* Payment method read service object.
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Checkout/etc/webapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<resource ref="Magento_Catalog::products" />
</resources>
</route>
<route url="/V1/carts" method="PUT">
<route url="/V1/carts" method="GET">
<service class="Magento\Checkout\Service\V1\Cart\ReadServiceInterface" method="getCartList"/>
<resources>
<resource ref="Magento_Catalog::products" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/
namespace Magento\CheckoutAgreements\Service\V1\Agreement;

use \Magento\CheckoutAgreements\Model\Resource\Agreement\CollectionFactory as AgreementCollectionFactory;
use \Magento\CheckoutAgreements\Model\Resource\Agreement\Collection as AgreementCollection;
use \Magento\CheckoutAgreements\Model\Agreement;
use \Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\CheckoutAgreements\Model\Resource\Agreement\CollectionFactory as AgreementCollectionFactory;
use Magento\CheckoutAgreements\Model\Resource\Agreement\Collection as AgreementCollection;
use Magento\CheckoutAgreements\Model\Agreement;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\StoreManagerInterface;
use \Magento\Store\Model\ScopeInterface;
use \Magento\CheckoutAgreements\Service\V1\Data\AgreementBuilder;
use \Magento\CheckoutAgreements\Service\V1\Data\Agreement as AgreementDataObject;
use Magento\Store\Model\ScopeInterface;
use Magento\CheckoutAgreements\Service\V1\Data\AgreementBuilder;
use Magento\CheckoutAgreements\Service\V1\Data\Agreement as AgreementDataObject;

/**
* Checkout agreement service.
Expand Down
16 changes: 8 additions & 8 deletions app/code/Magento/ConfigurableProduct/Model/OptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*/
namespace Magento\ConfigurableProduct\Model;

use \Magento\Framework\Exception\NoSuchEntityException;
use \Magento\Webapi\Exception;
use \Magento\Framework\Exception\StateException;
use \Magento\Framework\Exception\InputException;
use \Magento\Framework\Exception\CouldNotSaveException;
use \Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
use \Magento\Catalog\Model\Product\Type as ProductType;
use \Magento\Store\Model\Store;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Webapi\Exception;
use Magento\Framework\Exception\StateException;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
use Magento\Catalog\Model\Product\Type as ProductType;
use Magento\Store\Model\Store;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
/** @var $this \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config */

use \Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
?>
<div class="entry-edit form-inline" id="<?php echo $this->getId() ?>">
<div class="fieldset-wrapper collapsable-wrapper" id="<?php echo $this->getId() ?>-wrapper" data-panel="product-variations">
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Model/GroupManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\Customer\Api\Data\GroupInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\App\Config\ScopeConfigInterface;
use \Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Customer\Api\GroupRepositoryInterface;
Expand Down
12 changes: 0 additions & 12 deletions app/code/Magento/Customer/etc/webapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
<resource ref="Magento_Customer::group"/>
</resources>
</route>
<route url="/V1/customerGroups/search" method="POST">
<service class="Magento\Customer\Api\GroupRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Customer::group"/>
</resources>
</route>
<route url="/V1/customerGroups/search" method="GET">
<service class="Magento\Customer\Api\GroupRepositoryInterface" method="getList"/>
<resources>
Expand Down Expand Up @@ -161,12 +155,6 @@
<parameter name="customerId" force="true">%customer_id%</parameter>
</data>
</route>
<route url="/V1/customers/search" method="POST">
<service class="Magento\Customer\Api\CustomerRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Customer::customer"/>
</resources>
</route>
<route url="/V1/customers/search" method="GET">
<service class="Magento\Customer\Api\CustomerRepositoryInterface" method="getList"/>
<resources>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Eav/etc/webapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">
<route url="/V1/eav/attribute-sets/list" method="PUT">
<route url="/V1/eav/attribute-sets/list" method="GET">
<service class="Magento\Eav\Api\AttributeSetRepositoryInterface" method="getList"/>
<resources>
<resource ref="Magento_Catalog::sets"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ protected function _redirectOnSaveError()
* Save integration action.
*
* @return void
* @todo: Fix cyclomatic complexity.
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
Expand All @@ -56,7 +55,6 @@ public function execute()
/** @var array $data */
$data = $this->getRequest()->getPost();
if (!empty($data)) {
// TODO: Move out work with API permissions to Web API module
if (!isset($data['resource'])) {
$integrationData['resource'] = [];
}
Expand Down
17 changes: 14 additions & 3 deletions app/code/Magento/Integration/Model/Oauth/Token/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,24 @@ class Provider implements TokenProviderInterface
*/
protected $_tokenFactory;

/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;

/**
* @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory
* @param \Magento\Integration\Model\Oauth\TokenFactory $tokenFactory
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
\Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory,
\Magento\Integration\Model\Oauth\TokenFactory $tokenFactory
\Magento\Integration\Model\Oauth\TokenFactory $tokenFactory,
\Psr\Log\LoggerInterface $logger
) {
$this->_consumerFactory = $consumerFactory;
$this->_tokenFactory = $tokenFactory;
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -94,14 +102,17 @@ public function validateRequestToken($requestToken, $consumer, $oauthVerifier)
*/
public function getAccessToken($consumer)
{
/** TODO: log the request token in dev mode since its not persisted. */
$token = $this->getIntegrationTokenByConsumerId($consumer->getId());
$consumerId = $consumer->getId();
$token = $this->getIntegrationTokenByConsumerId($consumerId);
if (Token::TYPE_REQUEST != $token->getType()) {
throw new \Magento\Framework\Oauth\Exception(
'Cannot get access token because consumer token is not a request token'
);
}
$accessToken = $token->convertToAccess();
$this->logger->info(
'Request token ' . $token->getToken() . ' was exchanged to obtain access token for consumer ' . $consumerId
);
return ['oauth_token' => $accessToken->getToken(), 'oauth_token_secret' => $accessToken->getSecret()];
}

Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Integration/Service/V1/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function create(array $integrationData)
{
$this->_checkIntegrationByName($integrationData['name']);
$integration = $this->_integrationFactory->create($integrationData);
// TODO: Think about double save issue
$integration->save();
$consumerName = 'Integration' . $integration->getId();
$consumer = $this->_oauthService->createConsumer(['name' => $consumerName]);
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Integration/Service/V1/Oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/**
* Integration oAuth service.
*
* TODO: Fix coupling between objects
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Oauth implements OauthInterface
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/ProductAlert/Model/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ public function send()
return false;
}

$store = $this->_website->getDefaultStore();
if ($this->_customer->getStoreId() > 0) {
$store = $this->_storeManager->getStore($this->_customer->getStoreId());
} else {
$store = $this->_website->getDefaultStore();
}
$storeId = $store->getId();

if ($this->_type == 'price' && !$this->_scopeConfig->getValue(
Expand Down
Loading

0 comments on commit 2f31add

Please sign in to comment.