forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin user can call arbitrary Module class's constructor via Cart Pri…
…ce Rules magento#35135
- Loading branch information
Showing
53 changed files
with
248 additions
and
7,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/NewHtml.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog; | ||
|
||
use Magento\Backend\App\Action\Context; | ||
use Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog as CatalogAction; | ||
use Magento\Framework\Registry; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
use Magento\Framework\Stdlib\DateTime\Filter\Date; | ||
|
||
abstract class NewHtml extends CatalogAction | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected string $typeChecked = ''; | ||
|
||
/** | ||
* @var SerializerInterface | ||
*/ | ||
protected SerializerInterface $serializer; | ||
|
||
public function __construct( | ||
Context $context, | ||
Registry $coreRegistry, | ||
Date $dateFilter, | ||
SerializerInterface $serializer | ||
){ | ||
parent::__construct($context, $coreRegistry, $dateFilter); | ||
|
||
$this->serializer = $serializer; | ||
} | ||
|
||
/** | ||
* Verify class instance | ||
* | ||
* @param mixed $verifyClass | ||
* @return bool | ||
*/ | ||
public function verifyClassName($verifyClass): bool | ||
{ | ||
if ($verifyClass instanceof $this->typeChecked) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Get Error json | ||
* | ||
* @return bool|string | ||
*/ | ||
protected function getErrorJson() | ||
{ | ||
return $this->serializer->serialize( | ||
[ | ||
'error' => true, | ||
'message' => __('Selected type is not inherited from type %1', $this->typeChecked) | ||
] | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.