[-] FO: Fix module restriction with guest and visitors groups #PSCFV-4004
This commit is contained in:
+5
-1
@@ -257,6 +257,10 @@ class HookCore extends ObjectModel
|
|||||||
$shop_list = Shop::getContextListShopID();
|
$shop_list = Shop::getContextListShopID();
|
||||||
if (isset($context->customer) && $context->customer->isLogged())
|
if (isset($context->customer) && $context->customer->isLogged())
|
||||||
$groups = $context->customer->getGroups();
|
$groups = $context->customer->getGroups();
|
||||||
|
elseif (isset($context->customer) && $context->customer->isLogged(true))
|
||||||
|
$groups = array((int)Configuration::get('PS_GUEST_GROUP'));
|
||||||
|
else
|
||||||
|
$groups = array((int)Configuration::get('PS_UNIDENTIFIED_GROUP'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SQL Request
|
// SQL Request
|
||||||
@@ -274,7 +278,7 @@ class HookCore extends ObjectModel
|
|||||||
if (Validate::isLoadedObject($context->shop))
|
if (Validate::isLoadedObject($context->shop))
|
||||||
$sql->where('hm.id_shop = '.(int)$context->shop->id);
|
$sql->where('hm.id_shop = '.(int)$context->shop->id);
|
||||||
|
|
||||||
if (isset($context->customer) && $context->customer->isLogged())
|
if ($frontend)
|
||||||
{
|
{
|
||||||
$sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`');
|
$sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`');
|
||||||
$sql->where('mg.`id_group` IN ('.implode(', ', $groups).')');
|
$sql->where('mg.`id_group` IN ('.implode(', ', $groups).')');
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ abstract class ModuleCore
|
|||||||
public function disable($forceAll = false)
|
public function disable($forceAll = false)
|
||||||
{
|
{
|
||||||
// Disable module for all shops
|
// Disable module for all shops
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.$this->id.' '.((!$forceAll) ? ' AND `id_shop` IN('.implode(', ', Shop::getContextListShopID()).')' : '');
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.(int)$this->id.' '.((!$forceAll) ? ' AND `id_shop` IN('.implode(', ', Shop::getContextListShopID()).')' : '');
|
||||||
Db::getInstance()->execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user