Skip to content

Commit 1cbb8ed

Browse files
author
Yaroslav Onischenko
committed
MAGETWO-57811: [BACKPORT 2.0.10] It is possible to delete self admin account or role
2 parents 7421953 + a669a95 commit 1cbb8ed

File tree

25 files changed

+1015
-2
lines changed

25 files changed

+1015
-2
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function execute()
132132
$attributesData[$attributeCode] = $value;
133133
} elseif ($attribute->getFrontendInput() == 'multiselect') {
134134
// Check if 'Change' checkbox has been checked by admin for this attribute
135-
$isChanged = (bool)$this->getRequest()->getPost($attributeCode . '_checkbox');
135+
$isChanged = (bool)$this->getRequest()->getPost('toggle_' . $attributeCode);
136136
if (!$isChanged) {
137137
unset($attributesData[$attributeCode]);
138138
continue;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Client\Element;
8+
9+
use Magento\Mtf\Client\Locator;
10+
11+
/**
12+
* Custom checkbox that hidden by label
13+
*/
14+
class CheckboxwithlabelElement extends CheckboxElement
15+
{
16+
/**
17+
* Set checkbox value by clicking on label
18+
*
19+
* @param string $value
20+
*/
21+
public function setValue($value)
22+
{
23+
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
24+
if (($this->isSelected() && $value == 'No') || (!$this->isSelected() && $value == 'Yes')) {
25+
$this->find('./following-sibling::label', Locator::SELECTOR_XPATH)->click();
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Block;
8+
9+
use Magento\Mtf\Block\Block;
10+
use Magento\Mtf\Client\Locator;
11+
12+
class Version extends Block
13+
{
14+
/**
15+
* @var string
16+
*/
17+
protected $backendVersion = 'magento-version';
18+
19+
/**
20+
* Returns dashboard application version
21+
*
22+
* @return string
23+
*/
24+
public function getVersion()
25+
{
26+
return $this->_rootElement->find($this->backendVersion, Locator::SELECTOR_CLASS_NAME)->getText();
27+
}
28+
}

dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<block name="errorBlock" class="Magento\Backend\Test\Block\Page\Error" locator="[id='page:main-container']" strategy="css selector" />
1616
<block name="accessDeniedBlock" class="Magento\Backend\Test\Block\Denied" locator="#anchor-content" strategy="css selector" />
1717
<block name="systemMessageDialog" class="Magento\AdminNotification\Test\Block\System\Messages" locator='[role="dialog"].ui-popup-message' strategy="css selector" />
18+
<block name="applicationVersion" class="Magento\Backend\Test\Block\Version" locator="body" strategy="css selector" />
1819
</page>
1920
</config>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Upgrade\Test\Block;
8+
9+
use Magento\Mtf\Block\Form;
10+
use Magento\Mtf\Client\Element\SimpleElement;
11+
use Magento\Mtf\Client\Locator;
12+
use Magento\Mtf\Fixture\FixtureInterface;
13+
14+
/**
15+
* Perform Authentication block.
16+
*/
17+
class Authentication extends Form
18+
{
19+
/**
20+
* 'Save Config' button.
21+
*
22+
* @var string
23+
*/
24+
protected $save = "[ng-click*='saveAuthJson']";
25+
26+
/**
27+
* First field selector
28+
*
29+
* @var string
30+
*/
31+
protected $firstField = '[name="username"]';
32+
33+
/**
34+
* Click on 'Save Config' button.
35+
*
36+
* @return void
37+
*/
38+
public function clickSaveConfig()
39+
{
40+
$this->_rootElement->find($this->save, Locator::SELECTOR_CSS)->click();
41+
}
42+
43+
/**
44+
* Ensure the form is loaded and fill the root form
45+
*
46+
* @param FixtureInterface $fixture
47+
* @param SimpleElement|null $element
48+
* @return $this
49+
*/
50+
public function fill(FixtureInterface $fixture, SimpleElement $element = null)
51+
{
52+
$this->waitForElementVisible($this->firstField);
53+
return parent::fill($fixture, $element);
54+
}
55+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="1">
9+
<fields>
10+
<publicKey>
11+
<selector>[name='username']</selector>
12+
</publicKey>
13+
<privateKey>
14+
<selector>[name='password']</selector>
15+
</privateKey>
16+
</fields>
17+
</mapping>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Upgrade\Test\Block;
8+
9+
use Magento\Mtf\Block\Form;
10+
use Magento\Mtf\Client\Element\SimpleElement;
11+
use Magento\Mtf\Client\Locator;
12+
use Magento\Mtf\Fixture\FixtureInterface;
13+
14+
/**
15+
* Create Backup block.
16+
*/
17+
class CreateBackup extends Form
18+
{
19+
/**
20+
* 'Start Update' button.
21+
*
22+
* @var string
23+
*/
24+
protected $startUpdate = "[ng-click*='goToStartUpdater']";
25+
26+
/**
27+
* Click on 'Start Update/Next' button.
28+
*
29+
* @return void
30+
*/
31+
public function clickNext()
32+
{
33+
$this->_rootElement->find($this->startUpdate, Locator::SELECTOR_CSS)->click();
34+
}
35+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="0">
9+
<fields>
10+
<optionsCode>
11+
<selector>#optionsCode</selector>
12+
<input>checkboxwithlabel</input>
13+
</optionsCode>
14+
<optionsMedia>
15+
<selector>#optionsMedia</selector>
16+
<input>checkboxwithlabel</input>
17+
</optionsMedia>
18+
<optionsDb>
19+
<selector>#optionsDb</selector>
20+
<input>checkboxwithlabel</input>
21+
</optionsDb>
22+
</fields>
23+
</mapping>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Upgrade\Test\Block;
8+
9+
use Magento\Mtf\Block\Block;
10+
use Magento\Mtf\Client\Locator;
11+
12+
/**
13+
* Home block.
14+
*/
15+
class Home extends Block
16+
{
17+
/**
18+
* @var string
19+
*/
20+
protected $systemUpgrade = '.setup-home-item-upgrade';
21+
22+
/**
23+
* Click on 'System Upgrade' button.
24+
*
25+
* @return void
26+
*/
27+
public function clickSystemUpgrade()
28+
{
29+
$this->_rootElement->find($this->systemUpgrade, Locator::SELECTOR_CSS)->click();
30+
}
31+
}

0 commit comments

Comments
 (0)