Skip to content

Fix #38659 #39903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 14 additions & 12 deletions app/code/Magento/AdminAnalytics/composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "magento/module-admin-analytics",
"description": "N/A",
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"sort-packages": true
},
"version": "100.4.6",
"require": {
"php": "~8.1.0||~8.2.0||~8.3.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-config": "*",
"magento/module-store": "*",
"magento/module-ui": "*",
"magento/module-release-notification": "*",
"magento/module-csp": "*"
"magento/framework": "103.0.*",
"magento/module-backend": "102.0.*",
"magento/module-config": "101.2.*",
"magento/module-store": "101.1.*",
"magento/module-ui": "101.2.*",
"magento/module-release-notification": "100.4.*",
"magento/module-csp": "100.4.*"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
Expand All @@ -28,3 +29,4 @@
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminNotification\Block\Grid\MassAction;

use Magento\AdminNotification\Controller\Adminhtml\Notification\MarkAsRead;
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface;
use Magento\Framework\AuthorizationInterface;

/**
* Class checks if mark as read action can be displayed on massaction list
*/
class MarkAsReadVisibility implements VisibilityCheckerInterface
{
/**
* @var AuthorizationInterface
*/
private $authorization;

/**
* @param AuthorizationInterface $authorizationInterface
*/
public function __construct(AuthorizationInterface $authorizationInterface)
{
$this->authorization = $authorizationInterface;
}

/**
* @inheritdoc
*/
public function isVisible()
{
return $this->authorization->isAllowed(MarkAsRead::ADMIN_RESOURCE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminNotification\Block\Grid\MassAction;

use Magento\AdminNotification\Controller\Adminhtml\Notification\Remove;
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface;
use Magento\Framework\AuthorizationInterface;

/**
* Class checks if remove action can be displayed on massaction list
*/
class RemoveVisibility implements VisibilityCheckerInterface
{
/**
* @var AuthorizationInterface
*/
private $authorization;

/**
* @param AuthorizationInterface $authorizationInterface
*/
public function __construct(AuthorizationInterface $authorizationInterface)
{
$this->authorization = $authorizationInterface;
}

/**
* @inheritdoc
*/
public function isVisible()
{
return $this->authorization->isAllowed(Remove::ADMIN_RESOURCE);
}
}
53 changes: 30 additions & 23 deletions app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php
declare(strict_types=1);

/**
* Adminhtml AdminNotification Severity Renderer
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminNotification\Block\Grid\Renderer;

use Magento\AdminNotification\Controller\Adminhtml\Notification\MarkAsRead;
use Magento\AdminNotification\Controller\Adminhtml\Notification\Remove;
use Magento\Backend\Block\Context;
use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer;
use Magento\Framework\App\ActionInterface;
Expand Down Expand Up @@ -45,33 +44,41 @@ public function __construct(Context $context, Data $urlHelper, array $data = [])
*/
public function render(DataObject $row)
{
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' .
$readDetailsHtml = $row->getUrl() ?
'<a class="action-details" target="_blank" href="' .
$this->escapeUrl($row->getUrl())
. '">' .
__('Read Details') . '</a>' : '';

$markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl(
'*/*/markAsRead/',
['_current' => true, 'id' => $row->getNotificationId()]
) . '">' . __(
'Mark as Read'
) . '</a>' : '';
$markAsReadHtml = !$row->getIsRead()
&& $this->_authorization->isAllowed(MarkAsRead::ADMIN_RESOURCE) ?
'<a class="action-mark" href="' . $this->escapeUrl($this->getUrl(
'*/*/markAsRead/',
['_current' => true, 'id' => $row->getNotificationId()]
)) . '">' . __(
'Mark as Read'
) . '</a>' : '';

$removeUrl = $this->getUrl(
'*/*/remove/',
[
'_current' => true,
'id' => $row->getNotificationId(),
ActionInterface::PARAM_NAME_URL_ENCODED => $this->_urlHelper->getEncodedUrl()
]
);

$removeHtml = $this->_authorization->isAllowed(Remove::ADMIN_RESOURCE) ?
'<a class="action-delete" href="'
. $this->escapeUrl($removeUrl)
.'" onClick="deleteConfirm('. __('\'Are you sure?\'') .', this.href); return false;">'
. __('Remove') . '</a>' : '';

$encodedUrl = $this->_urlHelper->getEncodedUrl();
return sprintf(
'%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>',
'%s%s%s',
$readDetailsHtml,
$markAsReadHtml,
$this->getUrl(
'*/*/remove/',
[
'_current' => true,
'id' => $row->getNotificationId(),
ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
]
),
__('Are you sure?'),
__('Remove')
$removeHtml,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminNotification\Controller\Adminhtml\Notification;

use Magento\AdminNotification\Controller\Adminhtml\Notification;
Expand All @@ -16,6 +18,13 @@
*/
class AjaxMarkAsRead extends Notification implements HttpPostActionInterface
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
public const ADMIN_RESOURCE = 'Magento_AdminNotification::mark_as_read';

/**
* @var NotificationService
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\AdminNotification\Block\Grid\Renderer\Actions;
use Magento\Backend\Block\Context;
use Magento\Framework\DataObject;
use Magento\Framework\AuthorizationInterface;
use Magento\Framework\Escaper;
use Magento\Framework\Url\Helper\Data;
use Magento\Framework\UrlInterface;
Expand All @@ -35,16 +36,23 @@ protected function setUp(): void

/** @var Escaper|MockObject $escaperMock */
$escaperMock = $this->createMock(Escaper::class);
$escaperMock->expects($this->once())->method('escapeUrl')->willReturn('https://magento.com');
$escaperMock->expects($this->atLeastOnce())->method('escapeUrl')->willReturn('https://magento.com');

/** @var AuthorizationInterface|MockObject $authorizationMock */
$authorizationMock = $this->getMockForAbstractClass(AuthorizationInterface::class);
$authorizationMock->expects($this->atLeastOnce())
->method('isAllowed')
->willReturn(true);

/** @var UrlInterface|MockObject $urlBuilder */
$urlBuilder = $this->getMockForAbstractClass(UrlInterface::class);
$urlBuilder->expects($this->once())->method('getUrl')->willReturn('http://magento.com');

/** @var Context|MockObject $contextMock */
$contextMock = $this->createMock(Context::class);
$contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock);
$contextMock->expects($this->atLeastOnce())->method('getEscaper')->willReturn($escaperMock);
$contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilder);
$contextMock->expects($this->once())->method('getAuthorization')->willReturn($authorizationMock);

/** @var Data|MockObject $urlHelperMock */
$urlHelperMock = $this->createMock(Data::class);
Expand All @@ -65,7 +73,7 @@ public function testShouldRenderMessageWhenUrlIsGiven() : void
// Ignoring Code Style at this point due to the long HEREDOC
// phpcs:disable
$expected = <<<HTML
<a class="action-details" target="_blank" href="https://magento.com">Read Details</a><a class="action-delete" href="http://magento.com" onClick="deleteConfirm('Are you sure?', this.href); return false;">Remove</a>
<a class="action-details" target="_blank" href="https://magento.com">Read Details</a><a class="action-delete" href="https://magento.com" onClick="deleteConfirm('Are you sure?', this.href); return false;">Remove</a>
HTML;
// phpcs:enable

Expand Down
24 changes: 13 additions & 11 deletions app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "magento/module-admin-notification",
"description": "N/A",
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"sort-packages": true
},
"version": "100.4.6-p3",
"require": {
"php": "~8.1.0||~8.2.0||~8.3.0",
"lib-libxml": "*",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-media-storage": "*",
"magento/module-store": "*",
"magento/module-ui": "*",
"magento/module-config": "*"
"magento/framework": "103.0.*",
"magento/module-backend": "102.0.*",
"magento/module-media-storage": "100.4.*",
"magento/module-store": "101.1.*",
"magento/module-ui": "101.2.*",
"magento/module-config": "101.2.*"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
Expand All @@ -28,3 +29,4 @@
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@
<item name="mark_as_read" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Mark as Read</item>
<item name="url" xsi:type="string">*/*/massMarkAsRead</item>
<item name="visible" xsi:type="object">Magento\AdminNotification\Block\Grid\MassAction\MarkAsReadVisibility</item>
</item>
<item name="remove" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Remove</item>
<item name="url" xsi:type="string">*/*/massRemove</item>
<item name="confirm" xsi:type="string" translate="true">Are you sure?</item>
<item name="visible" xsi:type="object">Magento\AdminNotification\Block\Grid\MassAction\RemoveVisibility</item>
</item>
</argument>
</arguments>
Expand Down
30 changes: 16 additions & 14 deletions app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"name": "magento/module-advanced-pricing-import-export",
"description": "N/A",
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"sort-packages": true
},
"version": "100.4.7",
"require": {
"php": "~8.1.0||~8.2.0||~8.3.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-catalog-import-export": "*",
"magento/module-catalog-inventory": "*",
"magento/module-customer": "*",
"magento/module-eav": "*",
"magento/module-import-export": "*",
"magento/module-store": "*",
"magento/module-directory": "*"
"magento/framework": "103.0.*",
"magento/module-catalog": "104.0.*",
"magento/module-catalog-import-export": "101.1.*",
"magento/module-catalog-inventory": "100.4.*",
"magento/module-customer": "103.0.*",
"magento/module-eav": "102.1.*",
"magento/module-import-export": "101.0.*",
"magento/module-store": "101.1.*",
"magento/module-directory": "100.4.*"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
Expand All @@ -30,3 +31,4 @@
}
}
}

Loading