Skip to content

Commit d0c2414

Browse files
dmannersSebastianKull
authored andcommitted
CABPI-227: setup new plugins
- add two new plugins for removing fields and fieldsets, - update readme with tasks
1 parent b3eec32 commit d0c2414

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace Magento\AdminAdobeIms\Plugin;
4+
5+
use Magento\AdminAdobeIms\Service\ImsConfig;
6+
use Magento\Framework\Data\Form\Element\AbstractElement;
7+
use Magento\Framework\Data\Form\Element\Fieldset;
8+
9+
class RemoveCurrentUserVerificationFieldPlugin
10+
{
11+
/** @var ImsConfig */
12+
private ImsConfig $imsConfig;
13+
14+
/**
15+
* @param ImsConfig $imsConfig
16+
*/
17+
public function __construct(
18+
ImsConfig $imsConfig
19+
) {
20+
$this->imsConfig = $imsConfig;
21+
}
22+
23+
/**
24+
* @param Fieldset $subject
25+
* @param AbstractElement $result
26+
* @param string $elementId
27+
* @param string $type
28+
* @param array $config
29+
* @param bool $after
30+
* @param bool $isAdvanced
31+
* @return AbstractElement
32+
*/
33+
public function afterAddField(
34+
Fieldset $subject,
35+
AbstractElement $result,
36+
$elementId,
37+
$type,
38+
$config,
39+
$after = false,
40+
$isAdvanced = false
41+
): AbstractElement {
42+
if ($elementId !== \Magento\Backend\Block\System\Account\Edit\Form::IDENTITY_VERIFICATION_PASSWORD_FIELD) {
43+
return $result;
44+
}
45+
if ($this->imsConfig->enabled() !== true) {
46+
return $result;
47+
}
48+
49+
$subject->removeField($elementId);
50+
return $result;
51+
}
52+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Magento\AdminAdobeIms\Plugin;
4+
5+
use Magento\AdminAdobeIms\Service\ImsConfig;
6+
use Magento\Framework\Data\Form\AbstractForm;
7+
use Magento\Framework\Data\Form\Element\Fieldset;
8+
9+
class RemoveCurrentUserVerificationFieldsetPlugin
10+
{
11+
/** @var ImsConfig */
12+
private ImsConfig $imsConfig;
13+
14+
/**
15+
* @param ImsConfig $imsConfig
16+
*/
17+
public function __construct(
18+
ImsConfig $imsConfig
19+
) {
20+
$this->imsConfig = $imsConfig;
21+
}
22+
23+
/**
24+
* @param AbstractForm $subject
25+
* @param Fieldset $result
26+
* @param string $elementId
27+
* @param array $config
28+
* @param bool|string|null $after
29+
* @param bool $isAdvanced
30+
* @return Fieldset
31+
*/
32+
public function afterAddFieldset(
33+
AbstractForm $subject,
34+
Fieldset $result,
35+
$elementId,
36+
$config,
37+
$after = false,
38+
$isAdvanced = false)
39+
: Fieldset {
40+
if ($elementId !== 'current_user_verification_fieldset') {
41+
return $result;
42+
}
43+
if ($this->imsConfig->enabled() !== true) {
44+
return $result;
45+
}
46+
47+
$subject->removeField($elementId);
48+
return $result;
49+
}
50+
}

app/code/Magento/AdminAdobeIms/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,12 @@ Errors are logged into the `/var/log/admin_adobe_ims.log` file.
120120

121121
Logging can be enabled or disabled in the config on changing the value for `adobe_ims\integration\logging_enabled` or in the Magento Admin Configuration under `Advanced > Developer > Debug`. \
122122
There you can switch the toggle for `Enable Logging for Admin Adobe IMS Module`
123+
124+
# Password usage in Admin UI
125+
1. Remove current user password verification from form,
126+
2. Remove admin user set of passwords,
127+
3. Check that it is still updating the admin user information,
128+
4. Remove password refresh options from config,
129+
5. Validate that crons etc dont happen,
130+
6. Validate that when disabled the fields work again,
131+
7. Update Wiki

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@
2929
</argument>
3030
</arguments>
3131
</type>
32+
33+
<type name="Magento\Framework\Data\Form\AbstractForm">
34+
<plugin name="afterAddFieldset"
35+
type="Magento\AdminAdobeIms\Plugin\RemoveCurrentUserVerificationFieldsetPlugin"/>
36+
</type>
37+
<type name="Magento\Framework\Data\Form\Element\Fieldset">
38+
<plugin name="afterAddField"
39+
type="Magento\AdminAdobeIms\Plugin\RemoveCurrentUserVerificationFieldPlugin"/>
40+
</type>
3241
</config>

0 commit comments

Comments
 (0)