Skip to content

Commit 974d259

Browse files
committed
2.0.0.0-dev84
* Fixed bugs: * Fixed an issue where an invalidly filled option did not become in focus after saving attempt on the Create New Order page in the backend * Fixed an issue with the default configuration not being applied properly in the CAPTCHA configuration section * Fixed an issue with optional State/Province fields on the Create New Order page being marked as required * Fixed an issue with incorrect Customer model usage on session in community modules * Fixed an issue where cache was not invalidated after applying catalog price rule * Fixed an issue where an admin with custom permissions could not create Shopping Cart Price Rule/Catalog Price Rule * Fixed an issue with REST request and response format being inconsistent * Fixed an issue where there was an error on a bundle product page if bundle items contained an out of stock product * Fixed a JS issue which appeared when adding associated products for a grouped product * Fixed an issue where layered navigation was absent on the Advanced Search results page * Fixed an issue where the leading "0" in numbers were truncated when exporting using Excel XML * Fixed the price type attribute filter in Layered Navigation * Fixed an issue with a fatal error in \Magento\Framework\ArchiveTest when bz2 extension was not installed * Fixed an issue where an admin could search product by attributes set on the Store View level (except default store view) * Fixed an issue where extra spaces in search values were not ignored during search and thus wrong search results were given * GitHub requests: * [#542] Fix ImportExport bug which occurs while importing multiple rows per entity * [#544] Performance tests not working * Framework improvements: * Covered the following Magento application components with unit tests: * `Customer/Model/Address.php` * `Customer/Model/Address/AbstractAddress.php ` * `Customer/Model/Address/Converter.php` * `Customer/Model/Customer.php` * `Customer/Model/Customer/Attribute/Backend/Billing.php` * `Customer/Model/Customer/Attribute/Backend/Shipping.php` * `Customer/Model/Customer/Attribute/Backend/Store.php ` * `Customer/Model/Customer/Attribute/Backend/Website.php ` * `Customer/Model/Customer/Attribute/Backend/PasswordTest.php` * `Customer/Helper/Address.php` * `Customer/Helper/View.php` * `Customer/Service/V1/CustomerAccountService.php` * Covered Magento lib with unit tests: * `lib/internal/Magento/Framework/Filter/*` * `lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php` * `lib/internal/Magento/Framework/Model/Resource/Db/Collection/AbstractCollection.php` * `lib/internal/Magento/Framework/File/Uploader.php` * `lib/internal/Magento/Framework/File/Csv.php` * `lib/internal/Magento/Framework/Less/File/Collector/Aggregated.php` * `lib/internal/Magento/Framework/Less/File/Collector/Library.php` * `lib/internal/Magento/Framework/Locale/Config.php` * `lib/internal/Magento/Framework/Locale/Currency.php` * `lib/internal/Magento/Framework/App/Config/Element.php` * `lib/internal/Magento/Framework/App/Config/Value.php` * `lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php` * `lib/internal/Magento/Framework/App/EntryPoint/EntryPoint.php` * `lib/internal/Magento/Framework/App/Helper/AbstractHelper.php` * `lib/internal/Magento/Framework/App/Resource/ConnectionFactory.php` * `lib/internal/Magento/Framework/App/Route/Config.php` * Implemented the ability for a mobile client to get a partial response * Added authentication support for mobile * Refactored the Oauth lib exception not to reference module classes * Moved the authorization services according to the new directory format: was \Magento\Authz\Service\AuthorizationV1Interface, became \Magento\Authz\Service\V1\AuthorizationInterface * Moved the integration services according to the new directory format: * Was \Magento\Integration\Service\IntegrationV1, became \Magento\Integration\Service\V1\Integration * Was \Magento\Integration\Service\OauthV1, became \Magento\Integration\Service\V1\Oauth * Improved security of the integration registration * Introduced language packages with ability to inherit dictionaries * Improved modularity of ImportExport * Created Service API for Magento_Catalog module: * Implemented Product Attribute Media API * Implemented Product Group Price API * Implemented Product Attribute Write API * Implemented Product Attribute Options Read and Write API * Created Service for the Magento Tax module: * Implemented Tax Rule Service * Implemented Tax Rate Service * Implemented Tax Calculation Data Objects * Implemented Tax Calculation Builders * Implemented Tax Calculation Service * Covered the part of the Catalog Module with unit tests * Added PayPall Bill Me Later button * Streamlined checkout experience * Improved order review page for PayPal Express Checkout
1 parent ea1a2b7 commit 974d259

File tree

783 files changed

+29318
-4472
lines changed

Some content is hidden

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

783 files changed

+29318
-4472
lines changed

CHANGELOG.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
2.0.0.0-dev84
2+
=============
3+
* Fixed bugs:
4+
* Fixed an issue where an invalidly filled option did not become in focus after saving attempt on the Create New Order page in the backend
5+
* Fixed an issue with the default configuration not being applied properly in the CAPTCHA configuration section
6+
* Fixed an issue with optional State/Province fields on the Create New Order page being marked as required
7+
* Fixed an issue with incorrect Customer model usage on session in community modules
8+
* Fixed an issue where cache was not invalidated after applying catalog price rule
9+
* Fixed an issue where an admin with custom permissions could not create Shopping Cart Price Rule/Catalog Price Rule
10+
* Fixed an issue with REST request and response format being inconsistent
11+
* Fixed an issue where there was an error on a bundle product page if bundle items contained an out of stock product
12+
* Fixed a JS issue which appeared when adding associated products for a grouped product
13+
* Fixed an issue where layered navigation was absent on the Advanced Search results page
14+
* Fixed an issue where the leading "0" in numbers were truncated when exporting using Excel XML
15+
* Fixed the price type attribute filter in Layered Navigation
16+
* Fixed an issue with a fatal error in \Magento\Framework\ArchiveTest when bz2 extension was not installed
17+
* Fixed an issue where an admin could search product by attributes set on the Store View level (except default store view)
18+
* Fixed an issue where extra spaces in search values were not ignored during search and thus wrong search results were given
19+
* GitHub requests:
20+
* [#542] Fix ImportExport bug which occurs while importing multiple rows per entity
21+
* [#544] Performance tests not working
22+
* Framework improvements:
23+
* Covered the following Magento application components with unit tests:
24+
* `Customer/Model/Address.php`
25+
* `Customer/Model/Address/AbstractAddress.php `
26+
* `Customer/Model/Address/Converter.php`
27+
* `Customer/Model/Customer.php`
28+
* `Customer/Model/Customer/Attribute/Backend/Billing.php`
29+
* `Customer/Model/Customer/Attribute/Backend/Shipping.php`
30+
* `Customer/Model/Customer/Attribute/Backend/Store.php `
31+
* `Customer/Model/Customer/Attribute/Backend/Website.php `
32+
* `Customer/Model/Customer/Attribute/Backend/PasswordTest.php`
33+
* `Customer/Helper/Address.php`
34+
* `Customer/Helper/View.php`
35+
* `Customer/Service/V1/CustomerAccountService.php`
36+
* Covered Magento lib with unit tests:
37+
* `lib/internal/Magento/Framework/Filter/*`
38+
* `lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php`
39+
* `lib/internal/Magento/Framework/Model/Resource/Db/Collection/AbstractCollection.php`
40+
* `lib/internal/Magento/Framework/File/Uploader.php`
41+
* `lib/internal/Magento/Framework/File/Csv.php`
42+
* `lib/internal/Magento/Framework/Less/File/Collector/Aggregated.php`
43+
* `lib/internal/Magento/Framework/Less/File/Collector/Library.php`
44+
* `lib/internal/Magento/Framework/Locale/Config.php`
45+
* `lib/internal/Magento/Framework/Locale/Currency.php`
46+
* `lib/internal/Magento/Framework/App/Config/Element.php`
47+
* `lib/internal/Magento/Framework/App/Config/Value.php`
48+
* `lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php`
49+
* `lib/internal/Magento/Framework/App/EntryPoint/EntryPoint.php`
50+
* `lib/internal/Magento/Framework/App/Helper/AbstractHelper.php`
51+
* `lib/internal/Magento/Framework/App/Resource/ConnectionFactory.php`
52+
* `lib/internal/Magento/Framework/App/Route/Config.php`
53+
* Implemented the ability for a mobile client to get a partial response
54+
* Added authentication support for mobile
55+
* Refactored the Oauth lib exception not to reference module classes
56+
* Moved the authorization services according to the new directory format: was \Magento\Authz\Service\AuthorizationV1Interface, became \Magento\Authz\Service\V1\AuthorizationInterface
57+
* Moved the integration services according to the new directory format:
58+
* Was \Magento\Integration\Service\IntegrationV1, became \Magento\Integration\Service\V1\Integration
59+
* Was \Magento\Integration\Service\OauthV1, became \Magento\Integration\Service\V1\Oauth
60+
* Improved security of the integration registration
61+
* Introduced language packages with ability to inherit dictionaries
62+
* Improved modularity of ImportExport
63+
* Created Service API for Magento_Catalog module:
64+
* Implemented Product Attribute Media API
65+
* Implemented Product Group Price API
66+
* Implemented Product Attribute Write API
67+
* Implemented Product Attribute Options Read and Write API
68+
* Created Service for the Magento Tax module:
69+
* Implemented Tax Rule Service
70+
* Implemented Tax Rate Service
71+
* Implemented Tax Calculation Data Objects
72+
* Implemented Tax Calculation Builders
73+
* Implemented Tax Calculation Service
74+
* Covered the part of the Catalog Module with unit tests
75+
* Added PayPall Bill Me Later button
76+
* Streamlined checkout experience
77+
* Improved order review page for PayPal Express Checkout
78+
179
2.0.0.0-dev83
280
=============
381
* Created the Service API for the Magento_Catalog Module:
@@ -221,7 +299,7 @@
221299
* Fixed price inconsistencies between catalog and shopping cart
222300
* Added support for maintaining consistent price including tax for customers with different tax rates
223301
* Added support for applying tax rules with different priorities to subtotal only
224-
302+
225303
* Fixed bugs:
226304
* Removed the extra '%' sign in the error\notice message on Gift Card Accounts page on the backend
227305
* Fixed an issue with image uploading functionality in the Catalog configuration

app/code/Magento/AdminNotification/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
-->
2626
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
27-
<module name="Magento_AdminNotification" version="2.0.0.0" active="true">
27+
<module name="Magento_AdminNotification" schema_version="2.0.0.0" active="true">
2828
<sequence>
2929
<module name="Magento_Core"/>
3030
<module name="Magento_Store"/>

app/code/Magento/Authorizenet/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
-->
2626
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
27-
<module name="Magento_Authorizenet" version="1.5.0.0" active="true">
27+
<module name="Magento_Authorizenet" schema_version="1.5.0.0" active="true">
2828
<sequence>
2929
<module name="Magento_Sales"/>
3030
<module name="Magento_Checkout"/>

app/code/Magento/Authz/Service/AuthorizationV1.php

Lines changed: 103 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
*/
2424
namespace Magento\Authz\Service;
2525

26-
use Magento\Framework\Acl\Builder as AclBuilder;
27-
use Magento\Framework\Acl;
2826
use Magento\Authz\Model\UserIdentifier;
27+
use Magento\Framework\Acl;
28+
use Magento\Framework\Acl\Builder as AclBuilder;
29+
use Magento\Framework\Acl\RootResource as RootAclResource;
2930
use Magento\Framework\Logger;
30-
use Magento\Webapi\ServiceException as ServiceException;
31-
use Magento\Webapi\ServiceResourceNotFoundException;
3231
use Magento\User\Model\Resource\Role\CollectionFactory as RoleCollectionFactory;
3332
use Magento\User\Model\Resource\Rules\CollectionFactory as RulesCollectionFactory;
3433
use Magento\User\Model\Role;
3534
use Magento\User\Model\RoleFactory;
3635
use Magento\User\Model\RulesFactory;
37-
use Magento\Framework\Acl\RootResource as RootAclResource;
36+
use Magento\Webapi\ServiceException as ServiceException;
37+
use Magento\Webapi\ServiceResourceNotFoundException;
3838

3939
/**
4040
* Authorization service.
@@ -44,6 +44,9 @@
4444
*/
4545
class AuthorizationV1 implements AuthorizationV1Interface
4646
{
47+
const PERMISSION_ANONYMOUS = 'anonymous';
48+
const PERMISSION_SELF = 'self';
49+
4750
/**
4851
* @var AclBuilder
4952
*/
@@ -121,29 +124,12 @@ public function __construct(
121124
*/
122125
public function isAllowed($resources, UserIdentifier $userIdentifier = null)
123126
{
124-
$resources = is_array($resources) ? $resources : array($resources);
127+
$resources = is_array($resources) ? $resources : [$resources];
125128
$userIdentifier = $userIdentifier ? $userIdentifier : $this->_userIdentifier;
126-
try {
127-
$role = $this->_getUserRole($userIdentifier);
128-
if (!$role) {
129-
throw new ServiceResourceNotFoundException(
130-
__(
131-
'Role for user with ID "%1" and user type "%2" cannot be found.',
132-
$userIdentifier->getUserId(),
133-
$userIdentifier->getUserType()
134-
)
135-
);
136-
}
137-
foreach ($resources as $resource) {
138-
if (!$this->_aclBuilder->getAcl()->isAllowed($role->getId(), $resource)) {
139-
return false;
140-
}
141-
}
129+
if ($this->_isAnonymousOrSelfAllowed($resources, $userIdentifier)) {
142130
return true;
143-
} catch (\Exception $e) {
144-
$this->_logger->logException($e);
145-
return false;
146131
}
132+
return $this->_isUserWithRoleAllowed($resources, $userIdentifier);
147133
}
148134

149135
/**
@@ -180,7 +166,12 @@ public function grantAllPermissions(UserIdentifier $userIdentifier)
180166
*/
181167
public function getAllowedResources(UserIdentifier $userIdentifier)
182168
{
183-
$allowedResources = array();
169+
if ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_GUEST) {
170+
return [self::PERMISSION_ANONYMOUS];
171+
} elseif ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_CUSTOMER) {
172+
return [self::PERMISSION_SELF];
173+
}
174+
$allowedResources = [];
184175
try {
185176
$role = $this->_getUserRole($userIdentifier);
186177
if (!$role) {
@@ -234,6 +225,9 @@ public function removePermissions(UserIdentifier $userIdentifier)
234225
protected function _createRole($userIdentifier)
235226
{
236227
$userType = $userIdentifier->getUserType();
228+
if (!$this->_canRoleBeCreatedForUserType($userType)) {
229+
throw new \LogicException("The role with user type '{$userType}' cannot be created");
230+
}
237231
$userId = $userIdentifier->getUserId();
238232
switch ($userType) {
239233
case UserIdentifier::USER_TYPE_INTEGRATION:
@@ -246,17 +240,12 @@ protected function _createRole($userIdentifier)
246240
throw new \LogicException("Unknown user type: '{$userType}'.");
247241
}
248242
$role = $this->_roleFactory->create();
249-
$role->setRoleName(
250-
$roleName
251-
)->setUserType(
252-
$userType
253-
)->setUserId(
254-
$userId
255-
)->setRoleType(
256-
$roleType
257-
)->setParentId(
258-
$parentId
259-
)->save();
243+
$role->setRoleName($roleName)
244+
->setUserType($userType)
245+
->setUserId($userId)
246+
->setRoleType($roleType)
247+
->setParentId($parentId)
248+
->save();
260249
return $role;
261250
}
262251

@@ -270,6 +259,9 @@ protected function _createRole($userIdentifier)
270259
protected function _deleteRole($userIdentifier)
271260
{
272261
$userType = $userIdentifier->getUserType();
262+
if (!$this->_canRoleBeCreatedForUserType($userType)) {
263+
throw new \LogicException("The role with user type '{$userType}' cannot be created or deleted.");
264+
}
273265
$userId = $userIdentifier->getUserId();
274266
switch ($userType) {
275267
case UserIdentifier::USER_TYPE_INTEGRATION:
@@ -287,13 +279,19 @@ protected function _deleteRole($userIdentifier)
287279
*
288280
* @param UserIdentifier $userIdentifier
289281
* @return Role|false Return false in case when no role associated with provided user was found.
282+
* @throws \LogicException
290283
*/
291284
protected function _getUserRole($userIdentifier)
292285
{
286+
if (!$this->_canRoleBeCreatedForUserType($userIdentifier)) {
287+
throw new \LogicException(
288+
"The role with user type '{$userIdentifier->getUserType()}' does not exist and cannot be created"
289+
);
290+
}
293291
$roleCollection = $this->_roleCollectionFactory->create();
294292
$userType = $userIdentifier->getUserType();
295-
$userId = $userIdentifier->getUserId();
296293
/** @var Role $role */
294+
$userId = $userIdentifier->getUserId();
297295
$role = $roleCollection->setUserFilter($userId, $userType)->getFirstItem();
298296
return $role->getId() ? $role : false;
299297
}
@@ -304,11 +302,78 @@ protected function _getUserRole($userIdentifier)
304302
* @param Role $role
305303
* @param string[] $resources
306304
* @return void
305+
* @throws \LogicException
307306
*/
308307
protected function _associateResourcesWithRole($role, array $resources)
309308
{
310309
/** @var \Magento\User\Model\Rules $rules */
311310
$rules = $this->_rulesFactory->create();
312311
$rules->setRoleId($role->getId())->setResources($resources)->saveRel();
313312
}
313+
314+
/**
315+
* Check if there role can be associated with user having provided user type.
316+
*
317+
* Roles cannot be created for guests and customers.
318+
*
319+
* @param string $userType
320+
* @return bool
321+
*/
322+
protected function _canRoleBeCreatedForUserType($userType)
323+
{
324+
return ($userType != UserIdentifier::USER_TYPE_CUSTOMER) && ($userType != UserIdentifier::USER_TYPE_GUEST);
325+
}
326+
327+
/**
328+
* Check if the user has permission to access the requested resources.
329+
*
330+
* @param string[] $resources
331+
* @param UserIdentifier $userIdentifier
332+
* @return bool
333+
*/
334+
protected function _isAnonymousOrSelfAllowed($resources, UserIdentifier $userIdentifier)
335+
{
336+
if (count($resources) == 1) {
337+
$resource = reset($resources);
338+
$isAnonymousAccess = ($resource == self::PERMISSION_ANONYMOUS);
339+
$isSelfAccess = ($userIdentifier->getUserType() == UserIdentifier::USER_TYPE_CUSTOMER)
340+
&& ($resource == self::PERMISSION_SELF);
341+
if ($isAnonymousAccess || $isSelfAccess) {
342+
return true;
343+
}
344+
}
345+
return false;
346+
}
347+
348+
/**
349+
* Check if user who has role is allowed to access requested resources.
350+
*
351+
* @param string[] $resources
352+
* @param UserIdentifier $userIdentifier
353+
* @return bool
354+
*/
355+
protected function _isUserWithRoleAllowed($resources, UserIdentifier $userIdentifier)
356+
{
357+
try {
358+
$role = $this->_getUserRole($userIdentifier);
359+
if (!$role) {
360+
throw new ServiceResourceNotFoundException(
361+
__(
362+
'Role for user with ID "%1" and user type "%2" cannot be found.',
363+
$userIdentifier->getUserId(),
364+
$userIdentifier->getUserType()
365+
)
366+
);
367+
}
368+
foreach ($resources as $resource) {
369+
if (!$this->_aclBuilder->getAcl()->isAllowed($role->getId(), $resource)) {
370+
return false;
371+
}
372+
}
373+
return true;
374+
} catch (\Exception $e) {
375+
$this->_logger->logException($e);
376+
return false;
377+
}
378+
}
314379
}

app/code/Magento/Authz/etc/module.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
*/
2525
-->
2626
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
27-
<module name="Magento_Authz" version="1.0.0.0" active="true">
27+
<module name="Magento_Authz" schema_version="1.0.0.0" active="true">
28+
<sequence>
29+
<module name="Magento_User"/>
30+
</sequence>
2831
<depends>
2932
<!--TODO: Dependency on Magento_User is temporary and should be eliminated when ACL is made global-->
3033
<module name="Magento_User"/>

app/code/Magento/Backend/Block/Widget/Grid.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,6 @@ protected function _prepareCollection()
397397
return $this;
398398
}
399399

400-
/**
401-
* Decode URL encoded filter value recursive callback method
402-
*
403-
* @param string &$value
404-
* @return void
405-
*/
406-
protected function _decodeFilter(&$value)
407-
{
408-
$value = $this->_backendHelper->decodeFilter($value);
409-
}
410-
411400
/**
412401
* Apply pagination to collection
413402
*

app/code/Magento/Backend/Helper/Data.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,22 @@ public function prepareFilterString($filterString)
177177
$data = array();
178178
$filterString = base64_decode($filterString);
179179
parse_str($filterString, $data);
180-
array_walk_recursive($data, array($this, 'decodeFilter'));
180+
array_walk_recursive(
181+
$data,
182+
// @codingStandardsIgnoreStart
183+
/**
184+
* Decodes URL-encoded string and trims whitespaces from the beginning and end of a string
185+
*
186+
* @param string $value
187+
*/
188+
// @codingStandardsIgnoreEnd
189+
function (&$value) {
190+
$value = trim(rawurldecode($value));
191+
}
192+
);
181193
return $data;
182194
}
183195

184-
/**
185-
* Decode URL encoded filter value recursive callback method
186-
*
187-
* @param string &$value
188-
* @return void
189-
*/
190-
public function decodeFilter(&$value)
191-
{
192-
$value = rawurldecode($value);
193-
}
194-
195196
/**
196197
* Generate unique token for reset password confirmation link
197198
*

0 commit comments

Comments
 (0)