/** * Check if access to the specified resources is prohibited to the user. * * @param int $integrationId * @param string[] $resources */ protected function _ensurePermissionsAreNotGranted($integrationId, $resources) { $this->userContextMock->expects($this->any())->method('getUserId')->will($this->returnValue($integrationId)); foreach ($resources as $resource) { $this->assertFalse($this->libAuthorization->isAllowed($resource), "Access to resource '{$resource}' is expected to be prohibited."); } }
/** * {@inheritdoc} */ public function isAllowed($resource, $privilege = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'isAllowed'); if (!$pluginInfo) { return parent::isAllowed($resource, $privilege); } else { return $this->___callPlugins('isAllowed', func_get_args(), $pluginInfo); } }
/** * Check current user permission on resource and privilege * * @param string $resource * @param string $privilege * @return boolean */ public function isAllowed($resource, $privilege = null) { return $resource == 'Magento_Sales::create' ? false : parent::isAllowed($resource, $privilege); }