Skip to content

Commit 5ca2f4f

Browse files
authored
Merge pull request #109 from nmalevanec/LAC-27(WIP)
[WIP]Log admin actions with Login as Customer.
2 parents 9df4250 + 72c0773 commit 5ca2f4f

32 files changed

+959
-316
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LoginAsCustomerLog\Api\Data;
9+
10+
use Magento\Framework\Api\ExtensibleDataInterface;
11+
12+
/**
13+
* Data interface for login as customer log.
14+
*
15+
* @api
16+
*/
17+
interface LogInterface extends ExtensibleDataInterface
18+
{
19+
const LOG_ID = 'log_id';
20+
const TIME = 'time';
21+
const CUSTOMER_ID = 'customer_id';
22+
const CUSTOMER_EMAIL = 'customer_email';
23+
const USER_ID = 'user_id';
24+
const USERNAME = 'user_name';
25+
26+
/**
27+
* Set login as customer log id.
28+
*
29+
* @param int $logId
30+
* @return void
31+
*/
32+
public function setLogId(int $logId): void;
33+
34+
/**
35+
* Retrieve login as customer log id.
36+
*
37+
* @return null|int
38+
*/
39+
public function getLogId(): ?int;
40+
41+
/**
42+
* Set login as customer log time.
43+
*
44+
* @param string $time
45+
* @return void
46+
*/
47+
public function setTime(string $time): void;
48+
49+
/**
50+
* Retrieve login as customer log time.
51+
*
52+
* @return null|string
53+
*/
54+
public function getTime(): ?string;
55+
56+
/**
57+
* Set login as customer log user id.
58+
*
59+
* @param int $userId
60+
* @return void
61+
*/
62+
public function setUserId(int $userId): void;
63+
64+
/**
65+
* Retrieve login as customer log user id.
66+
*
67+
* @return null|int
68+
*/
69+
public function getUserId(): ?int;
70+
71+
/**
72+
* Set login as customer log user name.
73+
*
74+
* @param string $userName
75+
* @return void
76+
*/
77+
public function setUserName(string $userName): void;
78+
79+
/**
80+
* Retrieve login as customer log user name.
81+
*
82+
* @return null|string
83+
*/
84+
public function getUserName(): ?string;
85+
86+
/**
87+
* Set login as customer log customer id.
88+
*
89+
* @param int $customerId
90+
* @return void
91+
*/
92+
public function setCustomerId(int $customerId): void;
93+
94+
/**
95+
* Retrieve login as customer log customer id.
96+
*
97+
* @return null|int
98+
*/
99+
public function getCustomerId(): ?int;
100+
101+
/**
102+
* Set login as customer log customer email.
103+
*
104+
* @param string $customerEmail
105+
* @return void
106+
*/
107+
public function setCustomerEmail(string $customerEmail): void;
108+
109+
/**
110+
* Retrieve login as customer log customer email.
111+
*
112+
* @return null|string
113+
*/
114+
public function getCustomerEmail(): ?string;
115+
116+
/**
117+
* Set log extension attributes.
118+
*
119+
* @param \Magento\LoginAsCustomerLog\Api\Data\LogExtensionInterface $extensionAttributes
120+
* @return void
121+
*/
122+
public function setExtensionAttributes(LogExtensionInterface $extensionAttributes): void;
123+
124+
/**
125+
* Retrieve log extension attributes.
126+
*
127+
* @return \Magento\LoginAsCustomerLog\Api\Data\LogExtensionInterface
128+
*/
129+
public function getExtensionAttributes(): LogExtensionInterface;
130+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LoginAsCustomerLog\Api\Data;
9+
10+
use \Magento\Framework\Api\SearchResultsInterface;
11+
12+
/**
13+
* Login as customer log entity search results interface.
14+
*
15+
* @api
16+
*/
17+
interface LogSearchResultsInterface extends SearchResultsInterface
18+
{
19+
/**
20+
* Get log list.
21+
*
22+
* @return \Magento\LoginAsCustomerLog\Api\Data\LogInterface[]
23+
*/
24+
public function getItems();
25+
26+
/**
27+
* Set log list.
28+
*
29+
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $items
30+
* @return void
31+
*/
32+
public function setItems(array $items);
33+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LoginAsCustomerLog\Api;
9+
10+
use Magento\Framework\Api\SearchCriteriaInterface;
11+
use Magento\LoginAsCustomerLog\Api\Data\LogSearchResultsInterface;
12+
13+
/**
14+
* Get login as customer log list considering search criteria.
15+
*
16+
* @api
17+
*/
18+
interface GetLogsListInterface
19+
{
20+
/**
21+
* Retrieve list of log entities.
22+
*
23+
* @param SearchCriteriaInterface $searchCriteria
24+
* @return LogSearchResultsInterface
25+
*/
26+
public function execute(SearchCriteriaInterface $searchCriteria): LogSearchResultsInterface;
27+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LoginAsCustomerLog\Api;
9+
10+
/**
11+
* Save login as custom logs entities.
12+
*
13+
* @api
14+
*/
15+
interface SaveLogsInterface
16+
{
17+
/**
18+
* Save logs.
19+
*
20+
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $logs
21+
* @return void
22+
*/
23+
public function execute(array $logs): void;
24+
}

app/code/Magento/LoginAsCustomerLog/Block/Adminhtml/Login.php

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LoginAsCustomerLog\Controller\Adminhtml\Log;
9+
10+
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
12+
use Magento\Framework\Controller\ResultFactory;
13+
use Magento\Framework\Controller\ResultInterface;
14+
15+
/**
16+
* Login As Customer log grid controller.
17+
*/
18+
class Index extends Action implements HttpGetActionInterface
19+
{
20+
const ADMIN_RESOURCE = 'Magento_LoginAsCustomerLog::login_log';
21+
22+
/**
23+
* @inheritdoc
24+
*/
25+
public function execute(): ResultInterface
26+
{
27+
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
28+
$resultPage->setActiveMenu('Magento_LoginAsCustomerLog::login_log')
29+
->addBreadcrumb(__('Login as Customer Log'), __('List'));
30+
$resultPage->getConfig()->getTitle()->prepend(__('Login as Customer Log'));
31+
32+
return $resultPage;
33+
}
34+
}

app/code/Magento/LoginAsCustomerLog/Controller/Adminhtml/Login/Grid.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

app/code/Magento/LoginAsCustomerLog/Controller/Adminhtml/Login/Index.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)