ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
class HandleActionPredispatch implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_DISPATCH
]);
$actionHandler = $this->actionFactory->create($metadata, Logging\ActionFactory::FETCH_ANY);
$actionHandler->execute();
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\LoginAttemptManagerInterface;
use Amasty\AdminActionsLog\Model\OptionSource\LoginAttemptStatus;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class HandleBackendAuthUserLoginFailed implements ObserverInterface
{
/**
* @var LoginAttemptManagerInterface
*/
private $loginAttemptManager;
public function __construct(
LoginAttemptManagerInterface $loginAttemptManager
) {
$this->loginAttemptManager = $loginAttemptManager;
}
public function execute(Observer $observer)
{
$this->loginAttemptManager->saveAttempt($observer->getUserName(), LoginAttemptStatus::FAILED);
}
}
@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
class HandleBackendAuthUserLoginSuccess implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_LOGIN
]);
$actionHandler = $this->actionFactory->create($metadata);
$actionHandler->execute();
}
}
@@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\View\Element\Template\Context;
class HandleLayoutRenderBefore implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
/**
* @var Context
*/
private $context;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory,
Context $context
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
$this->context = $context;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_LAYOUT_RENDER_BEFORE,
'loggingObject' => $this->context
]);
$actionHandler = $this->actionFactory->create($metadata);
$actionHandler->execute();
}
}
@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\LogEntryRepositoryInterface;
use Amasty\AdminActionsLog\Api\Logging\ObjectDataStorageInterface;
use Amasty\AdminActionsLog\Logging\ActionType\Delete\Entity;
use Magento\Framework\Event\ObserverInterface;
class HandleModelDeleteAfter implements ObserverInterface
{
/**
* @var ObjectDataStorageInterface
*/
private $dataStorage;
/**
* @var LogEntryRepositoryInterface
*/
private $logEntryRepository;
public function __construct(
ObjectDataStorageInterface $dataStorage,
LogEntryRepositoryInterface $logEntryRepository
) {
$this->dataStorage = $dataStorage;
$this->logEntryRepository = $logEntryRepository;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$deletedObject = $observer->getObject();
$storageKey = $deletedObject ? spl_object_id($deletedObject) . Entity::DELETE_LOG_ENTRY_POSTFIX : '';
if ($deletedObject && $this->dataStorage->isExists($storageKey)) {
$logEntry = $this->dataStorage->get($storageKey)['log'] ?? null;
if ($logEntry) {
$this->logEntryRepository->save($logEntry);
}
}
}
}
@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
class HandleModelDeleteBefore implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$deletedObject = $observer->getObject();
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_DELETE,
'loggingObject' => $deletedObject
]);
$actionHandler = $this->actionFactory->create($metadata);
$actionHandler->execute();
}
}
@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
class HandleModelSaveAfter implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$savedObject = $observer->getObject();
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_SAVE_AFTER,
'loggingObject' => $savedObject
]);
$actionHandler = $this->actionFactory->create($metadata);
$actionHandler->execute();
}
}
@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Observer;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
use Amasty\AdminActionsLog\Logging;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
class HandleModelSaveBefore implements ObserverInterface
{
/**
* @var RequestInterface
*/
private $request;
/**
* @var Logging\ActionFactory
*/
private $actionFactory;
/**
* @var MetadataInterfaceFactory
*/
private $metadataFactory;
public function __construct(
RequestInterface $request,
Logging\ActionFactory $actionFactory,
MetadataInterfaceFactory $metadataFactory
) {
$this->request = $request;
$this->actionFactory = $actionFactory;
$this->metadataFactory = $metadataFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$savedObject = $observer->getObject();
$metadata = $this->metadataFactory->create([
'request' => $this->request,
'eventName' => MetadataInterface::EVENT_SAVE_BEFORE,
'loggingObject' => $savedObject
]);
$actionHandler = $this->actionFactory->create($metadata);
$actionHandler->execute();
}
}