Skip to content

Commit 9d1da76

Browse files
committed
CABPI-427: [BUG] Current User Identity Verification does not work on New Integration page with enabled AdminIMS
1 parent 6b04a7b commit 9d1da76

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab;
10+
11+
use Magento\AdminAdobeIms\Plugin\AdobeImsReauth\AddAdobeImsReAuthButton;
12+
use Magento\AdminAdobeIms\Service\ImsConfig;
13+
use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info;
14+
15+
class AddReAuthVerification
16+
{
17+
/**
18+
* @var AddAdobeImsReAuthButton
19+
*/
20+
private AddAdobeImsReAuthButton $adobeImsReAuthButton;
21+
22+
/**
23+
* @var ImsConfig
24+
*/
25+
private ImsConfig $adminAdobeImsConfig;
26+
27+
/**
28+
* @param AddAdobeImsReAuthButton $adobeImsReAuthButton
29+
* @param ImsConfig $adminAdobeImsConfig
30+
*/
31+
public function __construct(
32+
AddAdobeImsReAuthButton $adobeImsReAuthButton,
33+
ImsConfig $adminAdobeImsConfig
34+
) {
35+
$this->adobeImsReAuthButton = $adobeImsReAuthButton;
36+
$this->adminAdobeImsConfig = $adminAdobeImsConfig;
37+
}
38+
39+
/**
40+
* Add adobeIms reAuth button to integration new/edit form
41+
*
42+
* @param Info $subject
43+
* @return void
44+
*/
45+
public function beforeGetFormHtml(Info $subject): void
46+
{
47+
if ($this->adminAdobeImsConfig->enabled()) {
48+
$form = $subject->getForm();
49+
if (is_object($form)) {
50+
$verificationFieldset = $form->getElement('current_user_verification_fieldset');
51+
if ($verificationFieldset !== null) {
52+
$this->adobeImsReAuthButton->addAdobeImsReAuthButton($verificationFieldset);
53+
$subject->setForm($form);
54+
}
55+
}
56+
}
57+
}
58+
}

app/code/Magento/AdminAdobeIms/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,9 @@
7979
<plugin name="authentication_component_config"
8080
type="Magento\AdminAdobeIms\Plugin\Block\Adminhtml\SignInPlugin"/>
8181
</type>
82+
83+
<type name="Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info">
84+
<plugin name="admin_adobe_ims_reauth_button_integration_edit"
85+
type="Magento\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab\AddReAuthVerification"/>
86+
</type>
8287
</config>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
9+
<body>
10+
<referenceContainer name="js">
11+
<block class="Magento\AdminAdobeIms\Block\Adminhtml\ImsReAuth" name="admin.adobe.ims.reauth" template="Magento_AdminAdobeIms::user/reauth.phtml"/>
12+
</referenceContainer>
13+
</body>
14+
</page>

0 commit comments

Comments
 (0)