File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
app/code/Magento/LoginAsCustomerLog Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \LoginAsCustomerLog \Controller \Adminhtml \Log ;
9
9
10
10
use Magento \Backend \App \Action ;
11
+ use Magento \Backend \App \Action \Context ;
11
12
use Magento \Framework \App \Action \HttpGetActionInterface ;
13
+ use Magento \Framework \App \RequestInterface ;
12
14
use Magento \Framework \Controller \ResultFactory ;
13
15
use Magento \Framework \Controller \ResultInterface ;
16
+ use Magento \LoginAsCustomerApi \Api \ConfigInterface ;
14
17
15
18
/**
16
19
* Login As Customer log grid controller.
@@ -19,6 +22,35 @@ class Index extends Action implements HttpGetActionInterface
19
22
{
20
23
const ADMIN_RESOURCE = 'Magento_LoginAsCustomerLog::login_log ' ;
21
24
25
+ /**
26
+ * @var ConfigInterface
27
+ */
28
+ private $ config ;
29
+
30
+ /**.
31
+ * @param Context $context
32
+ * @param ConfigInterface $config
33
+ */
34
+ public function __construct (
35
+ Context $ context ,
36
+ ConfigInterface $ config
37
+ ) {
38
+ parent ::__construct ($ context );
39
+ $ this ->config = $ config ;
40
+ }
41
+
42
+ /**
43
+ * @inheritdoc
44
+ */
45
+ public function dispatch (RequestInterface $ request )
46
+ {
47
+ if (!$ this ->config ->isEnabled () && ($ request ->getActionName () !== 'noroute ' )) {
48
+ $ this ->_forward ('noroute ' );
49
+ }
50
+
51
+ return parent ::dispatch ($ request );
52
+ }
53
+
22
54
/**
23
55
* @inheritdoc
24
56
*/
Original file line number Diff line number Diff line change 14
14
parent =" Magento_Customer::customer"
15
15
sortOrder =" 40"
16
16
resource =" Magento_LoginAsCustomerLog::login_log"
17
- action =" loginascustomer_log/log/index" />
17
+ action =" loginascustomer_log/log/index"
18
+ dependsOnConfig =" login_as_customer/general/enabled" />
18
19
</menu >
19
20
</config >
You can’t perform that action at this time.
0 commit comments