Skip to content

Commit dd65894

Browse files
author
Alex Paliarush
committed
MAGETWO-54460: Admin user with access to only one website is unable to edit a product
1 parent 2a70b82 commit dd65894

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ public function reindexByIds(array $ids)
159159
$this->doReindexByIds($ids);
160160
} catch (\Exception $e) {
161161
$this->critical($e);
162-
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
162+
throw new \Magento\Framework\Exception\LocalizedException(
163+
__("Catalog rule indexing failed. See details in exception log.")
164+
);
163165
}
164166
}
165167

@@ -193,7 +195,9 @@ public function reindexFull()
193195
$this->doReindexFull();
194196
} catch (\Exception $e) {
195197
$this->critical($e);
196-
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
198+
throw new \Magento\Framework\Exception\LocalizedException(
199+
__("Catalog rule indexing failed. See details in exception log.")
200+
);
197201
}
198202
}
199203

app/code/Magento/Rule/Model/ResourceModel/Rule/Collection/AbstractCollection.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,18 @@ public function addWebsitesToResult($flag = null)
7474
*/
7575
public function addWebsiteFilter($websiteId)
7676
{
77-
$entityInfo = $this->_getAssociatedEntityInfo('website');
7877
if (!$this->getFlag('is_website_table_joined')) {
78+
$websiteIds = is_array($websiteId) ? $websiteId : [$websiteId];
79+
$entityInfo = $this->_getAssociatedEntityInfo('website');
7980
$this->setFlag('is_website_table_joined', true);
80-
if ($websiteId instanceof \Magento\Store\Model\Website) {
81-
$websiteId = $websiteId->getId();
81+
foreach ($websiteIds as $index => $website) {
82+
if ($website instanceof \Magento\Store\Model\Website) {
83+
$websiteIds[$index] = $website->getId();
84+
}
8285
}
8386
$this->getSelect()->join(
8487
['website' => $this->getTable($entityInfo['associations_table'])],
85-
$this->getConnection()->quoteInto('website.' . $entityInfo['entity_id_field'] . ' = ?', $websiteId)
88+
$this->getConnection()->quoteInto('website.' . $entityInfo['entity_id_field'] . ' IN (?)', $websiteIds)
8689
. ' AND main_table.' . $entityInfo['rule_id_field'] . ' = website.' . $entityInfo['rule_id_field'],
8790
[]
8891
);

0 commit comments

Comments
 (0)