[-] BO: Admin Home do not display quick links when access is denied for employee

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16749 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-08-07 13:49:20 +00:00
parent c5a07b8c1a
commit 019be0aeff
2 changed files with 71 additions and 66 deletions
+51 -40
View File
@@ -181,53 +181,64 @@ class AdminHomeControllerCore extends AdminController
protected function getQuickLinks() protected function getQuickLinks()
{ {
$quick_links['first'] = array( $quick_links = array();
'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsbestproducts',
'title' => $this->l('Products sold recently'),
'description' => $this->l('Create a new category and organize your catalog.'),
);
$quick_links['second'] = array( $profile_access = Profile::getProfileAccesses($this->context->employee->id_profile);
'href' => $this->context->link->getAdminLink('AdminOrders').'&addorder', if ($profile_access[(int)Tab::getIdFromClassName('AdminStats')]['view'])
'title' => $this->l('New order'), $quick_links['first'] = array(
'description' => $this->l('Fill your catalog with new products.'), 'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsbestproducts',
); 'title' => $this->l('Products sold recently'),
'description' => $this->l('Create a new category and organize your catalog.'),
);
$quick_links['third'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminOrders')]['add'])
'href' => $this->context->link->getAdminLink('AdminSpecificPriceRule').'&addspecific_price_rule', $quick_links['second'] = array(
'title' => $this->l('New Price Rule for catalog'), 'href' => $this->context->link->getAdminLink('AdminOrders').'&addorder',
'description' => $this->l('Monitor your activity with a thorough analysis of your shop.'), 'title' => $this->l('New order'),
); 'description' => $this->l('Fill your catalog with new products.'),
);
$quick_links['fourth'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminSpecificPriceRule')]['add'])
'href' => $this->context->link->getAdminLink('AdminProducts').'&addproduct', $quick_links['third'] = array(
'title' => $this->l('New Product'), 'href' => $this->context->link->getAdminLink('AdminSpecificPriceRule').'&addspecific_price_rule',
'description' => $this->l('Add a new employee account and discharge a part of your duties as shop owner.'), 'title' => $this->l('New Price Rule for catalog'),
); 'description' => $this->l('Monitor your activity with a thorough analysis of your shop.'),
);
$quick_links['fifth'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminProducts')]['add'])
'href' => $this->context->link->getAdminLink('AdminModules').'&addcategory', $quick_links['fourth'] = array(
'title' => $this->l('New module'), 'href' => $this->context->link->getAdminLink('AdminProducts').'&addproduct',
'description' => $this->l('Create a new category and organize your catalog.'), 'title' => $this->l('New Product'),
); 'description' => $this->l('Add a new employee account and discharge a part of your duties as shop owner.'),
);
$quick_links['sixth'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminModules')]['view'])
'href' => $this->context->link->getAdminLink('AdminCartRules').'&addcart_rule', $quick_links['fifth'] = array(
'title' => $this->l('New Price Rule for cart'), 'href' => $this->context->link->getAdminLink('AdminModules'),
'description' => $this->l('Fill your catalog with new products.'), 'title' => $this->l('New module'),
); 'description' => $this->l('Configure your modules.'),
);
$quick_links['seventh'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminCartRules')]['add'])
'href' => $this->context->link->getAdminLink('AdminCmsContent').'&addcms', $quick_links['sixth'] = array(
'title' => $this->l('New Page CMS'), 'href' => $this->context->link->getAdminLink('AdminCartRules').'&addcart_rule',
'description' => $this->l('Monitor your activity with a thorough analysis of your shop.'), 'title' => $this->l('New Price Rule for cart'),
); 'description' => $this->l('Add new cart rule.'),
);
$quick_links['eighth'] = array( if ($profile_access[(int)Tab::getIdFromClassName('AdminCmsContent')]['add'])
'href' => $this->context->link->getAdminLink('AdminCarts').'&id_cart', $quick_links['seventh'] = array(
'title' => $this->l('Abandoned Carts'), 'href' => $this->context->link->getAdminLink('AdminCmsContent').'&addcms',
'description' => $this->l('Add a new employee account and discharge a part of your duties as shop owner.'), 'title' => $this->l('New Page CMS'),
); 'description' => $this->l('Add a new CMS page.'),
);
if ($profile_access[(int)Tab::getIdFromClassName('AdminCarts')]['view'])
$quick_links['eighth'] = array(
'href' => $this->context->link->getAdminLink('AdminCarts').'&id_cart',
'title' => $this->l('Abandoned Carts'),
'description' => $this->l('View your customer carts.'),
);
return $quick_links; return $quick_links;
} }
+15 -21
View File
@@ -81,10 +81,6 @@ class AdminWarehousesControllerCore extends AdminController
*/ */
public function renderList() public function renderList()
{ {
// Checks access
if (!($this->tabAccess['add'] === '1'))
unset($this->toolbar_btn['new']);
// removes links on rows // removes links on rows
$this->list_no_link = true; $this->list_no_link = true;
@@ -475,16 +471,24 @@ class AdminWarehousesControllerCore extends AdminController
} }
} }
/** public function initContent()
* Checks access of the employee
*/
public function processCheckAccess()
{ {
if (Tools::isSubmit('submitAdd'.$this->table) && !($this->tabAccess['add'] === '1')) if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{ {
$this->errors[] = Tools::displayError('You do not have the required permissions to add warehouses.'); $this->warnings[md5('PS_ADVANCED_STOCK_MANAGEMENT')] = $this->l('You need to activate advanced stock management prior to use this feature.');
return parent::postProcess(); return false;
} }
parent::initContent();
}
public function initProcess()
{
if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
$this->warnings[md5('PS_ADVANCED_STOCK_MANAGEMENT')] = $this->l('You need to activate advanced stock management prior to use this feature.');
return false;
}
parent::initProcess();
} }
/** /**
@@ -595,15 +599,5 @@ class AdminWarehousesControllerCore extends AdminController
return; return;
$obj->resetStockAvailable(); $obj->resetStockAvailable();
} }
/**
* @see AdminController::initProcess()
*/
public function initProcess()
{
// checks access
$this->processCheckAccess();
return parent::initprocess();
}
} }