Permalink
Browse files

MAGETWO-38568: Move PCI module code to new CE module

 - moved Pci module from EE to CE and renamed PasswordManagement
  • Loading branch information...
Cari Spruiell
Cari Spruiell committed Aug 18, 2015
1 parent 59cdd47 commit a54cad00b795db6eb30d3ce0fef796b45847b743
Showing with 2,616 additions and 0 deletions.
  1. +58 −0 app/code/Magento/PasswordManagement/Block/Adminhtml/Crypt/Key/Edit.php
  2. +55 −0 app/code/Magento/PasswordManagement/Block/Adminhtml/Crypt/Key/Form.php
  3. +24 −0 app/code/Magento/PasswordManagement/Block/Adminhtml/Locks.php
  4. +24 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Crypt/Key.php
  5. +42 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Crypt/Key/Index.php
  6. +86 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Crypt/Key/Save.php
  7. +24 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Locks.php
  8. +21 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Locks/Grid.php
  9. +23 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Locks/Index.php
  10. +35 −0 app/code/Magento/PasswordManagement/Controller/Adminhtml/Locks/MassUnlock.php
  11. +48 −0 app/code/Magento/PasswordManagement/LICENSE.txt
  12. +48 −0 app/code/Magento/PasswordManagement/LICENSE_AFL.txt
  13. +377 −0 app/code/Magento/PasswordManagement/Model/Backend/Observer.php
  14. +46 −0 app/code/Magento/PasswordManagement/Model/Observer.php
  15. +166 −0 app/code/Magento/PasswordManagement/Model/Resource/Admin/User.php
  16. +209 −0 app/code/Magento/PasswordManagement/Model/Resource/Key/Change.php
  17. +25 −0 app/code/Magento/PasswordManagement/Model/System/Config/Source/Password.php
  18. +2 −0 app/code/Magento/PasswordManagement/README.md
  19. +103 −0 app/code/Magento/PasswordManagement/Setup/InstallSchema.php
  20. +88 −0 app/code/Magento/PasswordManagement/Test/Unit/Model/ObserverTest.php
  21. +26 −0 app/code/Magento/PasswordManagement/composer.json
  22. +23 −0 app/code/Magento/PasswordManagement/etc/acl.xml
  23. +14 −0 app/code/Magento/PasswordManagement/etc/adminhtml/di.xml
  24. +21 −0 app/code/Magento/PasswordManagement/etc/adminhtml/events.xml
  25. +13 −0 app/code/Magento/PasswordManagement/etc/adminhtml/menu.xml
  26. +14 −0 app/code/Magento/PasswordManagement/etc/adminhtml/routes.xml
  27. +31 −0 app/code/Magento/PasswordManagement/etc/adminhtml/system.xml
  28. +20 −0 app/code/Magento/PasswordManagement/etc/config.xml
  29. +12 −0 app/code/Magento/PasswordManagement/etc/frontend/events.xml
  30. +28 −0 app/code/Magento/PasswordManagement/etc/logging.xml
  31. +15 −0 app/code/Magento/PasswordManagement/etc/module.xml
  32. +39 −0 app/code/Magento/PasswordManagement/i18n/de_DE.csv
  33. +39 −0 app/code/Magento/PasswordManagement/i18n/en_US.csv
  34. +39 −0 app/code/Magento/PasswordManagement/i18n/es_ES.csv
  35. +39 −0 app/code/Magento/PasswordManagement/i18n/fr_FR.csv
  36. +39 −0 app/code/Magento/PasswordManagement/i18n/nl_NL.csv
  37. +39 −0 app/code/Magento/PasswordManagement/i18n/pt_BR.csv
  38. +39 −0 app/code/Magento/PasswordManagement/i18n/zh_CN.csv
  39. +16 −0 app/code/Magento/PasswordManagement/view/adminhtml/layout/adminhtml_crypt_key_index.xml
  40. +94 −0 app/code/Magento/PasswordManagement/view/adminhtml/layout/adminhtml_locks_block.xml
  41. +14 −0 app/code/Magento/PasswordManagement/view/adminhtml/layout/adminhtml_locks_grid.xml
  42. +16 −0 app/code/Magento/PasswordManagement/view/adminhtml/layout/adminhtml_locks_index.xml
  43. +1 −0 composer.json
  44. +26 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/Block/Adminhtml/Crypt/Key/EditTest.php
  45. +54 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/Block/Adminhtml/Crypt/Key/FormTest.php
  46. +20 −0 ...sts/integration/testsuite/Magento/PasswordManagement/Controller/Adminhtml/Crypt/Key/IndexTest.php
  47. +105 −0 ...ests/integration/testsuite/Magento/PasswordManagement/Controller/Adminhtml/Crypt/Key/SaveTest.php
  48. +35 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/Controller/Adminhtml/Locks/GridTest.php
  49. +31 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/Controller/Adminhtml/Locks/IndexTest.php
  50. +38 −0 ...ts/integration/testsuite/Magento/PasswordManagement/Controller/Adminhtml/Locks/MassUnlockTest.php
  51. +98 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/Model/Resource/Key/ChangeTest.php
  52. +51 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/_files/locked_users.php
  53. +20 −0 dev/tests/integration/testsuite/Magento/PasswordManagement/_files/payment_info.php
  54. +1 −0 dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
  55. +2 −0 dev/tests/static/testsuite/Magento/Test/Legacy/_files/connection/blacklist/files_list.php
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Block\Adminhtml\Crypt\Key;
/**
* Encryption key change edit page block
*
*/
class Edit extends \Magento\Backend\Block\Widget\Form\Container
{
/**
* Block module name
*
* @var string|null
*/
protected $_blockGroup = null;
/**
* Controller name
*
* @var string
*/
protected $_controller = 'crypt_key';
/**
* Instantiate save button
*
* @return void
*/
protected function _construct()
{
\Magento\Framework\DataObject::__construct();
$this->buttonList->add(
'save',
[
'label' => __('Change Encryption Key'),
'class' => 'save primary save-encryption-key',
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']],
]
],
1
);
}
/**
* Header text getter
*
* @return \Magento\Framework\Phrase
*/
public function getHeaderText()
{
return __('Encryption Key');
}
}
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Block\Adminhtml\Crypt\Key;
// @codingStandardsIgnoreFile
/**
* Encryption key change form block
*/
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
* Add form fields
*
* @return $this
*/
protected function _prepareForm()
{
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(
['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
);
$fieldset = $form->addFieldset('main_fieldset', ['legend' => __('New Encryption Key')]);
$fieldset->addField(
'enc_key_note',
'note',
['text' => __('The encryption key is used to protect passwords and other sensitive data.')]
);
$fieldset->addField(
'generate_random',
'select',
[
'name' => 'generate_random',
'label' => __('Auto-generate a Key'),
'options' => [0 => __('No'), 1 => __('Yes')],
'onclick' => "var cryptKey = $('crypt_key'); cryptKey.disabled = this.value == 1; if (cryptKey.disabled) {cryptKey.parentNode.parentNode.hide();} else {cryptKey.parentNode.parentNode.show();}",
'note' => __('The generated key will be displayed after changing.')
]
);
$fieldset->addField(
'crypt_key',
'text',
['name' => 'crypt_key', 'label' => __('New Key'), 'style' => 'width:32em;', 'maxlength' => 32]
);
$form->setUseContainer(true);
if ($data = $this->getFormData()) {
$form->addValues($data);
}
$this->setForm($form);
return parent::_prepareForm();
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Block\Adminhtml;
/**
* Locked administrators page
*/
class Locks extends \Magento\Backend\Block\Widget\Grid\Container
{
/**
* {@inheritdoc}
*
* @codeCoverageIgnore
*/
protected function _construct()
{
parent::_construct();
$this->buttonList->remove('add');
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Encryption key changer controller
*
*/
namespace Magento\PasswordManagement\Controller\Adminhtml\Crypt;
abstract class Key extends \Magento\Backend\App\Action
{
/**
* Check whether current administrator session allows this controller
*
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magento_PasswordManagement::crypt_key');
}
}
@@ -0,0 +1,42 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Controller\Adminhtml\Crypt\Key;
class Index extends \Magento\PasswordManagement\Controller\Adminhtml\Crypt\Key
{
/**
* Render main page with form
*
* @return void
*/
public function execute()
{
/** @var \Magento\Framework\App\DeploymentConfig\Writer $writer */
$writer = $this->_objectManager->get('Magento\Framework\App\DeploymentConfig\Writer');
if (!$writer->checkIfWritable()) {
$this->messageManager->addError(__('Deployment configuration file is not writable.'));
}
$this->_view->loadLayout();
$this->_setActiveMenu('Magento_PasswordManagement::system_crypt_key');
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('Encryption Key'));
if (($formBlock = $this->_view->getLayout()->getBlock(
'pm.crypt.key.form'
)) && ($data = $this->_objectManager->get(
'Magento\Backend\Model\Session'
)->getFormData(
true
))
) {
/* @var \Magento\PasswordManagement\Block\Adminhtml\Crypt\Key\Form $formBlock */
$formBlock->setFormData($data);
}
$this->_view->renderLayout();
}
}
@@ -0,0 +1,86 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
namespace Magento\PasswordManagement\Controller\Adminhtml\Crypt\Key;
class Save extends \Magento\PasswordManagement\Controller\Adminhtml\Crypt\Key
{
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
*/
protected $encryptor;
/**
* @var \Magento\PasswordManagement\Model\Resource\Key\Change
*/
protected $change;
/**
* @var \Magento\Framework\App\CacheInterface
*/
protected $cache;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\PasswordManagement\Model\Resource\Key\Change $change
* @param \Magento\Framework\App\CacheInterface $cache
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Magento\PasswordManagement\Model\Resource\Key\Change $change,
\Magento\Framework\App\CacheInterface $cache
) {
$this->encryptor = $encryptor;
$this->change = $change;
$this->cache = $cache;
parent::__construct($context);
}
/**
* Process saving new encryption key
*
* @return void
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function execute()
{
try {
$key = null;
if (0 == $this->getRequest()->getPost('generate_random')) {
$key = $this->getRequest()->getPost('crypt_key');
if (empty($key)) {
throw new \Exception(__('Please enter an encryption key.'));
}
$this->encryptor->validateKey($key);
}
$newKey = $this->change->changeEncryptionKey($key);
$this->messageManager->addSuccess(__('The encryption key has been changed.'));
if (!$key) {
$this->messageManager->addNotice(
__(
'This is your new encryption key: <span style="font-family:monospace;">%1</span>. Be sure to write it down and take good care of it!',
$newKey
)
);
}
$this->cache->clean();
} catch (\Exception $e) {
if ($message = $e->getMessage()) {
$this->messageManager->addError($e->getMessage());
}
$this->_session->setFormData(['crypt_key' => $key]);
}
$this->_redirect('adminhtml/*/');
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Locked administrators controller
*
*/
namespace Magento\PasswordManagement\Controller\Adminhtml;
abstract class Locks extends \Magento\Backend\App\Action
{
/**
* Check whether access is allowed for current admin session
*
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magento_PasswordManagement::locks');
}
}
@@ -0,0 +1,21 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Controller\Adminhtml\Locks;
class Grid extends \Magento\PasswordManagement\Controller\Adminhtml\Locks
{
/**
* Render AJAX-grid only
*
* @return void
*/
public function execute()
{
$this->_view->loadLayout(false);
$this->_view->renderLayout();
}
}
@@ -0,0 +1,23 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PasswordManagement\Controller\Adminhtml\Locks;
class Index extends \Magento\PasswordManagement\Controller\Adminhtml\Locks
{
/**
* Render page with grid
*
* @return void
*/
public function execute()
{
$this->_view->loadLayout();
$this->_setActiveMenu('Magento_PasswordManagement::system_acl_locks');
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('Locked Users'));
$this->_view->renderLayout();
}
}
Oops, something went wrong.

0 comments on commit a54cad0

Please sign in to comment.