Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4-develop' into bugfix/rest-ap…
Browse files Browse the repository at this point in the history
…i-pagination
  • Loading branch information
lbajsarowicz committed Feb 29, 2020
2 parents e8d3b78 + a3c2af0 commit 6c171ce
Show file tree
Hide file tree
Showing 808 changed files with 2,281 additions and 1,516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="LoginAsAdmin">
<actionGroup name="AdminLoginActionGroup">
<conditionalClick selector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" dependentSelector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" visible="true" stepKey="clickDontAllowButtonIfVisible" before="closeAdminNotification"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="LoginAdminWithCredentialsActionGroup">
<actionGroup name="LoginAdminWithCredentialsActionGroup" deprecated="Use AdminLoginActionGroup instead">
<conditionalClick selector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" dependentSelector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" visible="true" stepKey="clickDontAllowButtonIfVisible" before="closeAdminNotification"/>
</actionGroup>
<actionGroup name="LoginAsAdmin" deprecated="Use AdminLoginActionGroup instead">
<conditionalClick selector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" dependentSelector="{{AdminUsageNotificationSection.adminUsageDontAllowButton}}" visible="true" stepKey="clickDontAllowButtonIfVisible" before="closeAdminNotification"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemNotificationPage">
<argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<!--Navigate through Advanced Reporting button on dashboard to Sign Up page-->
Expand All @@ -35,4 +35,4 @@
<switchToNextTab stepKey="switchToNewTab"/>
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
</test>
</tests>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateAdvancedReportingPage">
<argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<group value="analytics"/>
</annotations>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustryLabel}}" userInput="Industry" stepKey="seeAdvancedReportingIndustryLabel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<group value="analytics"/>
</annotations>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service" stepKey="seeAdvancedReportingServiceLabelEnabled"/>
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<group value="analytics"/>
</annotations>

<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustryLabel}}" userInput="Industry" stepKey="seeAdvancedReportingIndustryLabel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<before>
<createData entity="adminNoReportRole" stepKey="noReportUserRole"/>
<createData entity="adminNoReport" stepKey="noReportUser"/>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<amOnPage url="{{AdminUsersPage.url}}" stepKey="amOnAdminUsersPage"/>
<fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="$$noReportUser.username$$" stepKey="fillUsernameSearch"/>
Expand All @@ -51,7 +51,7 @@
<scrollTo selector="{{AdminConfigAdvancedReportingSection.advancedReportingMenuItem}}" stepKey="scrollToMenuItem"/>
<!--<see stepKey="seeAdvancedReportingConfigMenuItem" selector="{{AdminConfigAdvancedReportingSection.advancedReportingMenuItem}}" userInput="Advanced Reporting"/>-->
<seeElementInDOM selector="{{AdminConfigAdvancedReportingSection.advancedReportingMenuItem}}" stepKey="seeAdvancedReportingConfigMenuItem"/>
<actionGroup ref="logout" stepKey="logoutOfAdmin2"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin2"/>

<amOnPage url="{{AdminLoginPage.url}}" stepKey="amOnAdminLoginPage"/>
<fillField selector="{{AdminLoginFormSection.username}}" userInput="$$noReportUser.username$$" stepKey="fillUsernameNoReport"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<group value="analytics"/>
</annotations>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustry}}" userInput="Apps and Games" stepKey="selectAdvancedReportingIndustry"/>
Expand Down
47 changes: 27 additions & 20 deletions app/code/Magento/Authorization/Model/Acl/Loader/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,46 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Authorization\Model\Acl\Loader;

use Magento\Authorization\Model\Acl\Role\Group as RoleGroup;
use Magento\Authorization\Model\Acl\Role\GroupFactory;
use Magento\Authorization\Model\Acl\Role\User as RoleUser;
use Magento\Framework\App\ObjectManager;
use Magento\Authorization\Model\Acl\Role\UserFactory;
use Magento\Framework\Acl\Data\CacheInterface;
use Magento\Framework\Acl\LoaderInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Serialize\Serializer\Json;

class Role implements \Magento\Framework\Acl\LoaderInterface
/**
* Acl Role Loader
*/
class Role implements LoaderInterface
{
/**
* Cache key for ACL roles cache
*/
const ACL_ROLES_CACHE_KEY = 'authorization_role_cached_data';

/**
* @var \Magento\Framework\App\ResourceConnection
* @var ResourceConnection
*/
protected $_resource;

/**
* @var \Magento\Authorization\Model\Acl\Role\GroupFactory
* @var GroupFactory
*/
protected $_groupFactory;

/**
* @var \Magento\Authorization\Model\Acl\Role\UserFactory
* @var UserFactory
*/
protected $_roleFactory;

/**
* @var \Magento\Framework\Acl\Data\CacheInterface
* @var CacheInterface
*/
private $aclDataCache;

Expand All @@ -48,28 +57,26 @@ class Role implements \Magento\Framework\Acl\LoaderInterface
private $cacheKey;

/**
* @param \Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory
* @param \Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory
* @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
* @param GroupFactory $groupFactory
* @param UserFactory $roleFactory
* @param ResourceConnection $resource
* @param CacheInterface $aclDataCache
* @param Json $serializer
* @param string $cacheKey
*/
public function __construct(
\Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory,
\Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory,
\Magento\Framework\App\ResourceConnection $resource,
\Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null,
Json $serializer = null,
GroupFactory $groupFactory,
UserFactory $roleFactory,
ResourceConnection $resource,
CacheInterface $aclDataCache,
Json $serializer,
$cacheKey = self::ACL_ROLES_CACHE_KEY
) {
$this->_resource = $resource;
$this->_groupFactory = $groupFactory;
$this->_roleFactory = $roleFactory;
$this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
\Magento\Framework\Acl\Data\CacheInterface::class
);
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->_resource = $resource;
$this->aclDataCache = $aclDataCache;
$this->serializer = $serializer;
$this->cacheKey = $cacheKey;
}

Expand Down
44 changes: 25 additions & 19 deletions app/code/Magento/Authorization/Model/Acl/Loader/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,38 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Authorization\Model\Acl\Loader;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Acl\Data\CacheInterface;
use Magento\Framework\Acl\LoaderInterface;
use Magento\Framework\Acl\RootResource;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Serialize\Serializer\Json;

class Rule implements \Magento\Framework\Acl\LoaderInterface
/**
* Acl Rule Loader
*/
class Rule implements LoaderInterface
{
/**
* Rules array cache key
*/
const ACL_RULE_CACHE_KEY = 'authorization_rule_cached_data';

/**
* @var \Magento\Framework\App\ResourceConnection
* @var ResourceConnection
*/
protected $_resource;

/**
* @var \Magento\Framework\Acl\RootResource
* @var RootResource
*/
private $_rootResource;

/**
* @var \Magento\Framework\Acl\Data\CacheInterface
* @var CacheInterface
*/
private $aclDataCache;

Expand All @@ -41,28 +49,26 @@ class Rule implements \Magento\Framework\Acl\LoaderInterface
private $cacheKey;

/**
* @param \Magento\Framework\Acl\RootResource $rootResource
* @param \Magento\Framework\App\ResourceConnection $resource
* @param array $data
* @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
* @param RootResource $rootResource
* @param ResourceConnection $resource
* @param CacheInterface $aclDataCache
* @param Json $serializer
* @param array $data
* @param string $cacheKey
* @SuppressWarnings(PHPMD.UnusedFormalParameter):
*/
public function __construct(
\Magento\Framework\Acl\RootResource $rootResource,
\Magento\Framework\App\ResourceConnection $resource,
RootResource $rootResource,
ResourceConnection $resource,
CacheInterface $aclDataCache,
Json $serializer,
array $data = [],
\Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null,
Json $serializer = null,
$cacheKey = self::ACL_RULE_CACHE_KEY
) {
$this->_resource = $resource;
$this->_rootResource = $rootResource;
$this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
\Magento\Framework\Acl\Data\CacheInterface::class
);
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->_resource = $resource;
$this->aclDataCache = $aclDataCache;
$this->serializer = $serializer;
$this->cacheKey = $cacheKey;
}

Expand Down Expand Up @@ -104,7 +110,7 @@ private function getRulesArray()
return $this->serializer->unserialize($rulesCachedData);
}

$ruleTable = $this->_resource->getTableName("authorization_rule");
$ruleTable = $this->_resource->getTableName('authorization_rule');
$connection = $this->_resource->getConnection();
$select = $connection->select()
->from(['r' => $ruleTable]);
Expand Down
Loading

0 comments on commit 6c171ce

Please sign in to comment.