forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request magento#123 from magento-ogre/develop
[Ogre's] Sprint 24 Contribution
- Loading branch information
Showing
431 changed files
with
34,072 additions
and
32,881 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
app/code/Magento/AdminNotification/Setup/InstallSchema.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\AdminNotification\Setup; | ||
|
||
use Magento\Framework\Setup\InstallSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class InstallSchema implements InstallSchemaInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||
*/ | ||
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$installer = $setup; | ||
|
||
$installer->startSetup(); | ||
/** | ||
* Create table 'adminnotification_inbox' | ||
*/ | ||
$table = $installer->getConnection()->newTable( | ||
$installer->getTable('adminnotification_inbox') | ||
)->addColumn( | ||
'notification_id', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, | ||
null, | ||
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], | ||
'Notification id' | ||
)->addColumn( | ||
'severity', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
null, | ||
['unsigned' => true, 'nullable' => false, 'default' => '0'], | ||
'Problem type' | ||
)->addColumn( | ||
'date_added', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, | ||
null, | ||
['nullable' => false], | ||
'Create date' | ||
)->addColumn( | ||
'title', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, | ||
255, | ||
['nullable' => false], | ||
'Title' | ||
)->addColumn( | ||
'description', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, | ||
'64k', | ||
[], | ||
'Description' | ||
)->addColumn( | ||
'url', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, | ||
255, | ||
[], | ||
'Url' | ||
)->addColumn( | ||
'is_read', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
null, | ||
['unsigned' => true, 'nullable' => false, 'default' => '0'], | ||
'Flag if notification read' | ||
)->addColumn( | ||
'is_remove', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
null, | ||
['unsigned' => true, 'nullable' => false, 'default' => '0'], | ||
'Flag if notification might be removed' | ||
)->addIndex( | ||
$installer->getIdxName('adminnotification_inbox', ['severity']), | ||
['severity'] | ||
)->addIndex( | ||
$installer->getIdxName('adminnotification_inbox', ['is_read']), | ||
['is_read'] | ||
)->addIndex( | ||
$installer->getIdxName('adminnotification_inbox', ['is_remove']), | ||
['is_remove'] | ||
)->setComment( | ||
'Adminnotification Inbox' | ||
); | ||
$installer->getConnection()->createTable($table); | ||
|
||
/** | ||
* Create table 'admin_system_messages' | ||
*/ | ||
$table = $installer->getConnection()->newTable( | ||
$installer->getTable('admin_system_messages') | ||
)->addColumn( | ||
'identity', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, | ||
100, | ||
['nullable' => false, 'primary' => true], | ||
'Message id' | ||
)->addColumn( | ||
'severity', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, | ||
null, | ||
['unsigned' => true, 'nullable' => false, 'default' => '0'], | ||
'Problem type' | ||
)->addColumn( | ||
'created_at', | ||
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, | ||
null, | ||
['nullable' => false], | ||
'Create date' | ||
)->setComment( | ||
'Admin System Messages' | ||
); | ||
$installer->getConnection()->createTable($table); | ||
|
||
$installer->endSetup(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 0 additions & 112 deletions
112
app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Authorization\Setup; | ||
|
||
use Magento\Framework\Setup\InstallDataInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; | ||
use Magento\Authorization\Model\UserContextInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class InstallData implements InstallDataInterface | ||
{ | ||
/** | ||
* Authorization factory | ||
* | ||
* @var AuthorizationFactory | ||
*/ | ||
private $authFactory; | ||
|
||
/** | ||
* Init | ||
* | ||
* @param AuthorizationFactory $authFactory | ||
*/ | ||
public function __construct(AuthorizationFactory $authFactory) | ||
{ | ||
$this->authFactory = $authFactory; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$roleCollection = $this->authFactory->createRoleCollection() | ||
->addFieldToFilter('parent_id', 0) | ||
->addFieldToFilter('tree_level', 1) | ||
->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE) | ||
->addFieldToFilter('user_id', 0) | ||
->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN) | ||
->addFieldToFilter('role_name', 'Administrators'); | ||
|
||
if ($roleCollection->count() == 0) { | ||
$admGroupRole = $this->authFactory->createRole()->setData( | ||
[ | ||
'parent_id' => 0, | ||
'tree_level' => 1, | ||
'sort_order' => 1, | ||
'role_type' => RoleGroup::ROLE_TYPE, | ||
'user_id' => 0, | ||
'user_type' => UserContextInterface::USER_TYPE_ADMIN, | ||
'role_name' => 'Administrators', | ||
] | ||
)->save(); | ||
} else { | ||
foreach ($roleCollection as $item) { | ||
$admGroupRole = $item; | ||
break; | ||
} | ||
} | ||
|
||
$rulesCollection = $this->authFactory->createRulesCollection() | ||
->addFieldToFilter('role_id', $admGroupRole->getId()) | ||
->addFieldToFilter('resource_id', 'all'); | ||
|
||
if ($rulesCollection->count() == 0) { | ||
$this->authFactory->createRules()->setData( | ||
[ | ||
'role_id' => $admGroupRole->getId(), | ||
'resource_id' => 'Magento_Backend::all', | ||
'privileges' => null, | ||
'permission' => 'allow', | ||
] | ||
)->save(); | ||
} else { | ||
/** @var \Magento\Authorization\Model\Rules $rule */ | ||
foreach ($rulesCollection as $rule) { | ||
$rule->setData('resource_id', 'Magento_Backend::all')->save(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.