[*] BO : Rights verification for multi-shop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9198 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-10-10 16:10:57 +00:00
parent 5fe22693dd
commit a8a11c0ece
8 changed files with 155 additions and 51 deletions
+14 -3
View File
@@ -222,6 +222,7 @@ class AdminControllerCore extends Controller
{
if ($disable)
return true;
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if ($this->tabAccess['view'] === '1')
@@ -1050,14 +1051,24 @@ class AdminControllerCore extends Controller
Tools::redirectAdmin($url['path'].'?'.http_build_query($parseQuery));
}
$shopID = '';
$shop_id = '';
if ($this->context->cookie->shopContext)
{
$split = explode('-', $this->context->cookie->shopContext);
if (count($split) == 2 && $split[0] == 's')
$shopID = (int)$split[1];
$shop_id = (int)$split[1];
}
$this->context->shop = new Shop($shopID);
else if ($this->context->employee->id_profile == _PS_ADMIN_PROFILE_)
$shop_id = '';
else if ($this->context->shop->getTotalShopsWhoExists() != Employee::getTotalEmployeeShopById((int)$this->context->employee->id))
{
$shops = Employee::getEmployeeShopById((int)$this->context->employee->id);
$shop_id = (int)$shops[0];
}
else
Employee::getEmployeeShopAccess((int)$this->context->employee->id);
$this->context->shop = new Shop($shop_id);
/* Filter memorization */
if (isset($_POST) && !empty($_POST) && isset($this->table))