Skip to content

Commit

Permalink
Merge pull request #463 from magento-performance/CABPI-427
Browse files Browse the repository at this point in the history
CABPI-427: [BUG] User Identity Verification does not work on New Integration page with enabled AdminIMS
  • Loading branch information
andimov authored May 21, 2022
2 parents 6b04a7b + 9d1da76 commit 6508982
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab;

use Magento\AdminAdobeIms\Plugin\AdobeImsReauth\AddAdobeImsReAuthButton;
use Magento\AdminAdobeIms\Service\ImsConfig;
use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info;

class AddReAuthVerification
{
/**
* @var AddAdobeImsReAuthButton
*/
private AddAdobeImsReAuthButton $adobeImsReAuthButton;

/**
* @var ImsConfig
*/
private ImsConfig $adminAdobeImsConfig;

/**
* @param AddAdobeImsReAuthButton $adobeImsReAuthButton
* @param ImsConfig $adminAdobeImsConfig
*/
public function __construct(
AddAdobeImsReAuthButton $adobeImsReAuthButton,
ImsConfig $adminAdobeImsConfig
) {
$this->adobeImsReAuthButton = $adobeImsReAuthButton;
$this->adminAdobeImsConfig = $adminAdobeImsConfig;
}

/**
* Add adobeIms reAuth button to integration new/edit form
*
* @param Info $subject
* @return void
*/
public function beforeGetFormHtml(Info $subject): void
{
if ($this->adminAdobeImsConfig->enabled()) {
$form = $subject->getForm();
if (is_object($form)) {
$verificationFieldset = $form->getElement('current_user_verification_fieldset');
if ($verificationFieldset !== null) {
$this->adobeImsReAuthButton->addAdobeImsReAuthButton($verificationFieldset);
$subject->setForm($form);
}
}
}
}
}
5 changes: 5 additions & 0 deletions app/code/Magento/AdminAdobeIms/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@
<plugin name="authentication_component_config"
type="Magento\AdminAdobeIms\Plugin\Block\Adminhtml\SignInPlugin"/>
</type>

<type name="Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info">
<plugin name="admin_adobe_ims_reauth_button_integration_edit"
type="Magento\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab\AddReAuthVerification"/>
</type>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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">
<body>
<referenceContainer name="js">
<block class="Magento\AdminAdobeIms\Block\Adminhtml\ImsReAuth" name="admin.adobe.ims.reauth" template="Magento_AdminAdobeIms::user/reauth.phtml"/>
</referenceContainer>
</body>
</page>

0 comments on commit 6508982

Please sign in to comment.