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

Commit cd9d036

Browse files
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-87490-decode-directives
2 parents 5311735 + a29b455 commit cd9d036

File tree

461 files changed

+23085
-1899
lines changed

Some content is hidden

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

461 files changed

+23085
-1899
lines changed

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2017 Magento, Inc.
1+
Copyright © 2013-2018 Magento, Inc.
22

33
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
44

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ To suggest documentation improvements, click [here][4].
3838
| ![reject](http://devdocs.magento.com/common/images/github_reject.png) | The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. |
3939
| ![bug report](http://devdocs.magento.com/common/images/github_bug.png) | The Magento Team has confirmed that this issue contains the minimum required information to reproduce. |
4040
| ![acknowledged](http://devdocs.magento.com/common/images/gitHub_acknowledged.png) | The Magento Team has validated the issue and an internal ticket has been created. |
41-
| ![acknowledged](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
42-
| ![acknowledged](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
41+
| ![in progress](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
42+
| ![needs update](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
43+
44+
To learn more about issue gate labels click [here](https://github.com/magento/magento2/wiki/Magento-Issue-Gates)
4345

4446
<h2>Reporting security issues</h2>
4547

app/bootstrap.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@
4949
unset($_SERVER['ORIG_PATH_INFO']);
5050
}
5151

52-
if (!empty($_SERVER['MAGE_PROFILER'])
52+
if (
53+
(!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
5354
&& isset($_SERVER['HTTP_ACCEPT'])
5455
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
5556
) {
5657
\Magento\Framework\Profiler::applyConfig(
57-
$_SERVER['MAGE_PROFILER'],
58+
(isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])) ? $_SERVER['MAGE_PROFILER'] : trim(file_get_contents(BP . '/var/profiler.flag')),
5859
BP,
5960
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
6061
);

app/code/Magento/Analytics/Model/Connector/Http/JsonConverter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class JsonConverter implements ConverterInterface
2222
*/
2323
private $serializer;
2424

25+
/**
26+
* @param Json $serializer
27+
*/
2528
public function __construct(Json $serializer)
2629
{
2730
$this->serializer = $serializer;

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function execute()
122122
/**
123123
* Place order for checkout flow
124124
*
125-
* @return string
125+
* @return void
126126
*/
127127
protected function placeCheckoutOrder()
128128
{

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,29 @@ protected function _construct()
2222
$this->_headerText = __('Cache Storage Management');
2323
parent::_construct();
2424
$this->buttonList->remove('add');
25-
$this->buttonList->add(
26-
'flush_magento',
27-
[
28-
'label' => __('Flush Magento Cache'),
29-
'onclick' => 'setLocation(\'' . $this->getFlushSystemUrl() . '\')',
30-
'class' => 'primary flush-cache-magento'
31-
]
32-
);
3325

34-
$message = __('The cache storage may contain additional data. Are you sure that you want to flush it?');
35-
$this->buttonList->add(
36-
'flush_system',
37-
[
38-
'label' => __('Flush Cache Storage'),
39-
'onclick' => 'confirmSetLocation(\'' . $message . '\', \'' . $this->getFlushStorageUrl() . '\')',
40-
'class' => 'flush-cache-storage'
41-
]
42-
);
26+
if ($this->_authorization->isAllowed('Magento_Backend::flush_magento_cache')) {
27+
$this->buttonList->add(
28+
'flush_magento',
29+
[
30+
'label' => __('Flush Magento Cache'),
31+
'onclick' => 'setLocation(\'' . $this->getFlushSystemUrl() . '\')',
32+
'class' => 'primary flush-cache-magento'
33+
]
34+
);
35+
}
36+
37+
if ($this->_authorization->isAllowed('Magento_Backend::flush_cache_storage')) {
38+
$message = __('The cache storage may contain additional data. Are you sure that you want to flush it?');
39+
$this->buttonList->add(
40+
'flush_system',
41+
[
42+
'label' => __('Flush Cache Storage'),
43+
'onclick' => 'confirmSetLocation(\'' . $message . '\', \'' . $this->getFlushStorageUrl() . '\')',
44+
'class' => 'flush-cache-storage'
45+
]
46+
);
47+
}
4348
}
4449

4550
/**
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Block\Cache;
8+
9+
use Magento\Framework\AuthorizationInterface;
10+
use Magento\Framework\View\Element\Block\ArgumentInterface;
11+
12+
/**
13+
* Class Permissions
14+
*/
15+
class Permissions implements ArgumentInterface
16+
{
17+
/**
18+
* @var AuthorizationInterface
19+
*/
20+
private $authorization;
21+
22+
/**
23+
* Permissions constructor.
24+
*
25+
* @param AuthorizationInterface $authorization
26+
*/
27+
public function __construct(AuthorizationInterface $authorization)
28+
{
29+
$this->authorization = $authorization;
30+
}
31+
32+
/**
33+
* @return bool
34+
*/
35+
public function hasAccessToFlushCatalogImages()
36+
{
37+
return $this->authorization->isAllowed('Magento_Backend::flush_catalog_images');
38+
}
39+
/**
40+
* @return bool
41+
*/
42+
public function hasAccessToFlushJsCss()
43+
{
44+
return $this->authorization->isAllowed('Magento_Backend::flush_js_css');
45+
}
46+
/**
47+
* @return bool
48+
*/
49+
public function hasAccessToFlushStaticFiles()
50+
{
51+
return $this->authorization->isAllowed('Magento_Backend::flush_static_files');
52+
}
53+
/**
54+
* @return bool
55+
*/
56+
public function hasAccessToAdditionalActions()
57+
{
58+
return ($this->hasAccessToFlushCatalogImages()
59+
|| $this->hasAccessToFlushJsCss()
60+
|| $this->hasAccessToFlushStaticFiles());
61+
}
62+
}

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Backend\Block\Widget\Grid;
78

9+
use Magento\Backend\Block\Template\Context;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\AuthorizationInterface;
12+
use Magento\Framework\DataObject;
13+
use Magento\Framework\Json\EncoderInterface;
14+
815
/**
916
* Grid widget massaction default block
1017
*
@@ -14,4 +21,72 @@
1421
*/
1522
class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\AbstractMassaction
1623
{
24+
/**
25+
* @var AuthorizationInterface
26+
*/
27+
private $authorization;
28+
29+
/**
30+
* Map bind item id to a particular acl type
31+
* itemId => acl
32+
*
33+
* @var array
34+
*/
35+
private $restrictions = [
36+
'enable' => 'Magento_Backend::toggling_cache_type',
37+
'disable' => 'Magento_Backend::toggling_cache_type',
38+
'refresh' => 'Magento_Backend::refresh_cache_type',
39+
];
40+
41+
/**
42+
* Massaction constructor.
43+
*
44+
* @param Context $context
45+
* @param EncoderInterface $jsonEncoder
46+
* @param array $data
47+
* @param AuthorizationInterface $authorization
48+
*/
49+
public function __construct(
50+
Context $context,
51+
EncoderInterface $jsonEncoder,
52+
array $data = [],
53+
AuthorizationInterface $authorization = null
54+
) {
55+
$this->authorization = $authorization ?: ObjectManager::getInstance()->get(AuthorizationInterface::class);
56+
57+
parent::__construct($context, $jsonEncoder, $data);
58+
}
59+
60+
/**
61+
* {@inheritdoc}
62+
*
63+
* @param string $itemId
64+
* @param array|DataObject $item
65+
*
66+
* @return $this
67+
*/
68+
public function addItem($itemId, $item)
69+
{
70+
if (!$this->isRestricted($itemId)) {
71+
parent::addItem($itemId, $item);
72+
}
73+
74+
return $this;
75+
}
76+
77+
/**
78+
* Check if access to action restricted
79+
*
80+
* @param string $itemId
81+
*
82+
* @return bool
83+
*/
84+
private function isRestricted(string $itemId): bool
85+
{
86+
if (!key_exists($itemId, $this->restrictions)) {
87+
return false;
88+
}
89+
90+
return !$this->authorization->isAllowed($this->restrictions[$itemId]);
91+
}
1792
}

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
class CleanImages extends \Magento\Backend\Controller\Adminhtml\Cache
1313
{
14+
/**
15+
* Authorization level of a basic admin session
16+
*
17+
* @see _isAllowed()
18+
*/
19+
const ADMIN_RESOURCE = 'Magento_Backend::flush_catalog_images';
20+
1421
/**
1522
* Clean JS/css files cache
1623
*

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
class CleanMedia extends \Magento\Backend\Controller\Adminhtml\Cache
1313
{
14+
/**
15+
* Authorization level of a basic admin session
16+
*
17+
* @see _isAllowed()
18+
*/
19+
const ADMIN_RESOURCE = 'Magento_Backend::flush_js_css';
20+
1421
/**
1522
* Clean JS/css files cache
1623
*

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
class CleanStaticFiles extends \Magento\Backend\Controller\Adminhtml\Cache
1212
{
13+
/**
14+
* Authorization level of a basic admin session
15+
*
16+
* @see _isAllowed()
17+
*/
18+
const ADMIN_RESOURCE = 'Magento_Backend::flush_static_files';
19+
1320
/**
1421
* Clean static files cache
1522
*

app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
class FlushAll extends \Magento\Backend\Controller\Adminhtml\Cache
1010
{
11+
/**
12+
* Authorization level of a basic admin session
13+
*
14+
* @see _isAllowed()
15+
*/
16+
const ADMIN_RESOURCE = 'Magento_Backend::flush_cache_storage';
17+
1118
/**
1219
* Flush cache storage
1320
*

app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
class FlushSystem extends \Magento\Backend\Controller\Adminhtml\Cache
1010
{
11+
/**
12+
* Authorization level of a basic admin session
13+
*
14+
* @see _isAllowed()
15+
*/
16+
const ADMIN_RESOURCE = 'Magento_Backend::flush_magento_cache';
17+
1118
/**
1219
* Flush all magento cache
1320
*

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
*/
1717
class MassDisable extends \Magento\Backend\Controller\Adminhtml\Cache
1818
{
19+
/**
20+
* Authorization level of a basic admin session
21+
*
22+
* @see _isAllowed()
23+
*/
24+
const ADMIN_RESOURCE = 'Magento_Backend::toggling_cache_type';
25+
1926
/**
2027
* @var State
2128
*/

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
*/
1717
class MassEnable extends \Magento\Backend\Controller\Adminhtml\Cache
1818
{
19+
/**
20+
* Authorization level of a basic admin session
21+
*
22+
* @see _isAllowed()
23+
*/
24+
const ADMIN_RESOURCE = 'Magento_Backend::toggling_cache_type';
25+
1926
/**
2027
* @var State
2128
*/

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
class MassRefresh extends \Magento\Backend\Controller\Adminhtml\Cache
1313
{
14+
/**
15+
* Authorization level of a basic admin session
16+
*
17+
* @see _isAllowed()
18+
*/
19+
const ADMIN_RESOURCE = 'Magento_Backend::refresh_cache_type';
20+
1421
/**
1522
* Mass action for cache refresh
1623
*

0 commit comments

Comments
 (0)