Skip to content

Commit 5b402d5

Browse files
committed
LAC-27: Log admin actions with Login as Customer.
1 parent 2a32f89 commit 5b402d5

File tree

15 files changed

+270
-244
lines changed

15 files changed

+270
-244
lines changed

app/code/Magento/LoginAsCustomerLog/Api/Data/LogInterface.php

Lines changed: 25 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ interface LogInterface extends ExtensibleDataInterface
1616
{
1717
const LOG_ID = 'log_id';
1818
const TIME = 'time';
19-
const ACTION_GROUP = 'action_group';
20-
const ACTION = 'action';
21-
const FULL_ACTION_NAME = 'full_action_name';
22-
const RESULT = 'result';
23-
const DETAILS = 'details';
24-
const ERROR = 'error';
25-
const IP_ADDRESS = 'ip_address';
26-
const USERNAME = 'username';
2719
const CUSTOMER_ID = 'customer_id';
20+
const CUSTOMER_EMAIL = 'customer_email';
21+
const USER_ID = 'user_id';
22+
const USERNAME = 'user_name';
2823

2924
/**
3025
* Set login as customer log id.
@@ -44,10 +39,10 @@ public function getLogId(): ?int;
4439
/**
4540
* Set login as customer log time.
4641
*
47-
* @param string $name
42+
* @param string $time
4843
* @return void
4944
*/
50-
public function setTime(string $name): void;
45+
public function setTime(string $time): void;
5146

5247
/**
5348
* Retrieve login as customer log time.
@@ -57,139 +52,64 @@ public function setTime(string $name): void;
5752
public function getTime(): ?string;
5853

5954
/**
60-
* Set login as customer log action group.
55+
* Set login as customer log user id.
6156
*
62-
* @param string $actionGroup
57+
* @param int $userId
6358
* @return void
6459
*/
65-
public function setActionGroup(string $actionGroup): void;
60+
public function setUserId(int $userId): void;
6661

6762
/**
68-
* Retrieve login as customer log action group.
69-
*
70-
* @return null|string
71-
*/
72-
public function getActionGroup(): ?string;
73-
74-
/**
75-
* Set login as customer log action.
76-
*
77-
* @param string $action
78-
* @return void
79-
*/
80-
public function setAction(string $action): void;
81-
82-
/**
83-
* Retrieve login as customer log action.
84-
*
85-
* @return null|string
86-
*/
87-
public function getAction(): ?string;
88-
89-
/**
90-
* Set login as customer log full action name.
91-
*
92-
* @param string $fullActionName
93-
* @return void
94-
*/
95-
public function setFullActionName(string $fullActionName): void;
96-
97-
/**
98-
* Retrieve login as customer log full action name.
99-
*
100-
* @return null|string
101-
*/
102-
public function getFullActionName(): ?string;
103-
104-
/**
105-
* Set login as customer log result.
106-
*
107-
* @param int $result
108-
* @return void
109-
*/
110-
public function setResult(int $result): void;
111-
112-
/**
113-
* Retrieve login as customer log result.
63+
* Retrieve login as customer log user id.
11464
*
11565
* @return null|int
11666
*/
117-
public function getResult(): ?int;
67+
public function getUserId(): ?int;
11868

11969
/**
120-
* Set login as customer log details.
70+
* Set login as customer log user name.
12171
*
122-
* @param string $details
72+
* @param string $userName
12373
* @return void
12474
*/
125-
public function setDetails(string $details): void;
75+
public function setUserName(string $userName): void;
12676

12777
/**
128-
* Retrieve login as customer log details.
78+
* Retrieve login as customer log user name.
12979
*
13080
* @return null|string
13181
*/
132-
public function getDetails(): ?string;
82+
public function getUserName(): ?string;
13383

13484
/**
135-
* Set login as customer log error.
136-
*
137-
* @param string $error
138-
* @return void
139-
*/
140-
public function setError(string $error): void;
141-
142-
/**
143-
* Retrieve login as customer log error.
144-
*
145-
* @return string|null
146-
*/
147-
public function getError(): ?string;
148-
149-
/**
150-
* Set login as customer log ip address.
85+
* Set login as customer log customer id.
15186
*
152-
* @param int $ipAddress
87+
* @param int $customerId
15388
* @return void
15489
*/
155-
public function setIpAddress(int $ipAddress): void;
90+
public function setCustomerId(int $customerId): void;
15691

15792
/**
158-
* Retrieve login as customer log ip address.
93+
* Retrieve login as customer log customer id.
15994
*
16095
* @return null|int
16196
*/
162-
public function getIpAddress(): ?int;
97+
public function getCustomerId(): ?int;
16398

16499
/**
165-
* Set login as customer log user name.
100+
* Set login as customer log customer email.
166101
*
167-
* @param string $username
102+
* @param string $customerEmail
168103
* @return void
169104
*/
170-
public function setUsername(string $username): void;
105+
public function setCustomerEmail(string $customerEmail): void;
171106

172107
/**
173-
* Retrieve login as customer log user name.
108+
* Retrieve login as customer log customer email.
174109
*
175110
* @return null|string
176111
*/
177-
public function getUsername(): ?string;
178-
179-
/**
180-
* Set login as customer log customer id.
181-
*
182-
* @param int $customerId
183-
* @return void
184-
*/
185-
public function setCustomerId(int $customerId): void;
186-
187-
/**
188-
* Retrieve login as customer log customer id.
189-
*
190-
* @return null|int
191-
*/
192-
public function getCustomerId(): ?int;
112+
public function getCustomerEmail(): ?string;
193113

194114
/**
195115
* Set log extension attributes.

app/code/Magento/LoginAsCustomerLog/Api/Data/LogSearchResultsInterface.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99

1010
use \Magento\Framework\Api\SearchResultsInterface;
1111

12+
/**
13+
* Login as customer log entity search results interface.
14+
*/
1215
interface LogSearchResultsInterface extends SearchResultsInterface
1316
{
1417
/**
15-
* Get sources list
18+
* Get log list.
1619
*
1720
* @return \Magento\LoginAsCustomerLog\Api\Data\LogInterface[]
1821
*/
1922
public function getItems();
2023

2124
/**
22-
* Set sources list
25+
* Set log list.
2326
*
2427
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $items
2528
* @return void

app/code/Magento/LoginAsCustomerLog/Api/GetLogsListInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
use Magento\LoginAsCustomerLog\Api\Data\LogSearchResultsInterface;
1212

1313
/**
14-
* @todo: add description.
14+
* Get login as customer log list considering search criteria.
1515
*/
1616
interface GetLogsListInterface
1717
{
1818
/**
19+
* Retrieve list of log entities.
20+
*
1921
* @param SearchCriteriaInterface $searchCriteria
2022
* @return LogSearchResultsInterface
2123
*/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
interface SaveLogsInterface
14+
{
15+
/**
16+
* Save logs.
17+
*
18+
* @param \Magento\LoginAsCustomerLog\Api\Data\LogInterface[] $logs
19+
* @return void
20+
*/
21+
public function execute(array $logs): void;
22+
}

0 commit comments

Comments
 (0)