Skip to content

Commit

Permalink
Merge pull request #109 from nmalevanec/LAC-27(WIP)
Browse files Browse the repository at this point in the history
[WIP]Log admin actions with Login as Customer.
  • Loading branch information
naydav authored Apr 30, 2020
2 parents 9df4250 + 72c0773 commit 5ca2f4f
Show file tree
Hide file tree
Showing 32 changed files with 959 additions and 316 deletions.
130 changes: 130 additions & 0 deletions app/code/Magento/LoginAsCustomerLog/Api/Data/LogInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\LoginAsCustomerLog\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;

/**
* Data interface for login as customer log.
*
* @api
*/
interface LogInterface extends ExtensibleDataInterface
{
const LOG_ID = 'log_id';
const TIME = 'time';
const CUSTOMER_ID = 'customer_id';
const CUSTOMER_EMAIL = 'customer_email';
const USER_ID = 'user_id';
const USERNAME = 'user_name';

/**
* Set login as customer log id.
*
* @param int $logId
* @return void
*/
public function setLogId(int $logId): void;

/**
* Retrieve login as customer log id.
*
* @return null|int
*/
public function getLogId(): ?int;

/**
* Set login as customer log time.
*
* @param string $time
* @return void
*/
public function setTime(string $time): void;

/**
* Retrieve login as customer log time.
*
* @return null|string
*/
public function getTime(): ?string;

/**
* Set login as customer log user id.
*
* @param int $userId
* @return void
*/
public function setUserId(int $userId): void;

/**
* Retrieve login as customer log user id.
*
* @return null|int
*/
public function getUserId(): ?int;

/**
* Set login as customer log user name.
*
* @param string $userName
* @return void
*/
public function setUserName(string $userName): void;

/**
* Retrieve login as customer log user name.
*
* @return null|string
*/
public function getUserName(): ?string;

/**
* Set login as customer log customer id.
*
* @param int $customerId
* @return void
*/
public function setCustomerId(int $customerId): void;

/**
* Retrieve login as customer log customer id.
*
* @return null|int
*/
public function getCustomerId(): ?int;

/**
* Set login as customer log customer email.
*
* @param string $customerEmail
* @return void
*/
public function setCustomerEmail(string $customerEmail): void;

/**
* Retrieve login as customer log customer email.
*
* @return null|string
*/
public function getCustomerEmail(): ?string;

/**
* Set log extension attributes.
*
* @param \Magento\LoginAsCustomerLog\Api\Data\LogExtensionInterface $extensionAttributes
* @return void
*/
public function setExtensionAttributes(LogExtensionInterface $extensionAttributes): void;

/**
* Retrieve log extension attributes.
*
* @return \Magento\LoginAsCustomerLog\Api\Data\LogExtensionInterface
*/
public function getExtensionAttributes(): LogExtensionInterface;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\LoginAsCustomerLog\Api\Data;

use \Magento\Framework\Api\SearchResultsInterface;

/**
* Login as customer log entity search results interface.
*
* @api
*/
interface LogSearchResultsInterface extends SearchResultsInterface
{
/**
* Get log list.
*
* @return \Magento\LoginAsCustomerLog\Api\Data\LogInterface[]
*/
public function getItems();

/**
* Set log list.
*
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $items
* @return void
*/
public function setItems(array $items);
}
27 changes: 27 additions & 0 deletions app/code/Magento/LoginAsCustomerLog/Api/GetLogsListInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\LoginAsCustomerLog\Api;

use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\LoginAsCustomerLog\Api\Data\LogSearchResultsInterface;

/**
* Get login as customer log list considering search criteria.
*
* @api
*/
interface GetLogsListInterface
{
/**
* Retrieve list of log entities.
*
* @param SearchCriteriaInterface $searchCriteria
* @return LogSearchResultsInterface
*/
public function execute(SearchCriteriaInterface $searchCriteria): LogSearchResultsInterface;
}
24 changes: 24 additions & 0 deletions app/code/Magento/LoginAsCustomerLog/Api/SaveLogsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\LoginAsCustomerLog\Api;

/**
* Save login as custom logs entities.
*
* @api
*/
interface SaveLogsInterface
{
/**
* Save logs.
*
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $logs
* @return void
*/
public function execute(array $logs): void;
}
27 changes: 0 additions & 27 deletions app/code/Magento/LoginAsCustomerLog/Block/Adminhtml/Login.php

This file was deleted.

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

namespace Magento\LoginAsCustomerLog\Controller\Adminhtml\Log;

use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;

/**
* Login As Customer log grid controller.
*/
class Index extends Action implements HttpGetActionInterface
{
const ADMIN_RESOURCE = 'Magento_LoginAsCustomerLog::login_log';

/**
* @inheritdoc
*/
public function execute(): ResultInterface
{
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->setActiveMenu('Magento_LoginAsCustomerLog::login_log')
->addBreadcrumb(__('Login as Customer Log'), __('List'));
$resultPage->getConfig()->getTitle()->prepend(__('Login as Customer Log'));

return $resultPage;
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5ca2f4f

Please sign in to comment.