[*] BO : reorganization of admin tabs
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13820 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated 1.5.0
|
||||
*/
|
||||
abstract class AdminTabCore
|
||||
{
|
||||
/** @var integer Tab id */
|
||||
@@ -200,7 +203,7 @@ abstract class AdminTabCore
|
||||
);
|
||||
|
||||
/** @var array noTabLink array of admintabs with no content */
|
||||
public $noTabLink = array('AdminCatalog', 'AdminTools', 'AdminStock', 'AdminAccounting');
|
||||
public $noTabLink = array('AdminCatalog', 'AdminPriceRule', 'AdminTools', 'AdminStock', 'AdminAdmin');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
+10
-6
@@ -1582,21 +1582,25 @@ abstract class ModuleCore
|
||||
return false;
|
||||
if (!$employee)
|
||||
$employee = Context::getContext()->employee;
|
||||
if (!isset($cache_permissions[$employee->id_profile]))
|
||||
|
||||
if ($employee->id_profile == _PS_ADMIN_PROFILE_)
|
||||
return true;
|
||||
|
||||
if (!isset(self::$cache_permissions[$employee->id_profile]))
|
||||
{
|
||||
$cache_permissions[$employee->id_profile] = array();
|
||||
self::$cache_permissions[$employee->id_profile] = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `id_module`, `view`, `configure` FROM `'._DB_PREFIX_.'module_access` WHERE `id_profile` = '.(int)$employee->id_profile);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
||||
$cache_permissions[$employee->id_profile][$row['id_module']]['configure'] = $row['configure'];
|
||||
self::$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
||||
self::$cache_permissions[$employee->id_profile][$row['id_module']]['configure'] = $row['configure'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($cache_permissions[$employee->id_profile][$id_module]))
|
||||
if (!isset(self::$cache_permissions[$employee->id_profile][$id_module]))
|
||||
throw new PrestaShopException('No access reference in table module_access for id_module '.$id_module.'.');
|
||||
|
||||
return (bool)$cache_permissions[$employee->id_profile][$id_module][$variable];
|
||||
return (bool)self::$cache_permissions[$employee->id_profile][$id_module][$variable];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+26
-10
@@ -114,17 +114,33 @@ class ProfileCore extends ObjectModel
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile]))
|
||||
{
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'access`
|
||||
WHERE `id_profile` = '.(int)$id_profile);
|
||||
|
||||
self::$_cache_accesses[$id_profile] = array();
|
||||
foreach ($result as $row)
|
||||
// Super admin profile has full auth
|
||||
if ($id_profile == _PS_ADMIN_PROFILE_)
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile][$row['id_tab']]))
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = array();
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = $row;
|
||||
foreach (Tab::getTabs(Context::getContext()->language->id) as $tab)
|
||||
self::$_cache_accesses[$id_profile][$tab['id_tab']] = array(
|
||||
'id_profile' => _PS_ADMIN_PROFILE_,
|
||||
'id_tab' => $tab['id_tab'],
|
||||
'view' => '1',
|
||||
'add' => '1',
|
||||
'edit' => '1',
|
||||
'delete' => '1',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'access`
|
||||
WHERE `id_profile` = '.(int)$id_profile);
|
||||
|
||||
self::$_cache_accesses[$id_profile] = array();
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile][$row['id_tab']]))
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = array();
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
return self::$_cache_accesses[$id_profile];
|
||||
|
||||
@@ -429,6 +429,9 @@ class TabCore extends ObjectModel
|
||||
{
|
||||
static $tabAccesses = null;
|
||||
|
||||
if (Context::getContext()->employee->id_profile == _PS_ADMIN_PROFILE_)
|
||||
return true;
|
||||
|
||||
if ($tabAccesses === null)
|
||||
$tabAccesses = Profile::getProfileAccesses(Context::getContext()->employee->id_profile);
|
||||
|
||||
|
||||
+13
-13
@@ -1558,9 +1558,6 @@ class ToolsCore
|
||||
if (is_null($disable_multiviews))
|
||||
$disable_multiviews = (int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS');
|
||||
|
||||
if (!$rewrite_settings && !Shop::isFeatureActive())
|
||||
return true;
|
||||
|
||||
// Check current content of .htaccess and save all code outside of prestashop comments
|
||||
$specific_before = $specific_after = '';
|
||||
if (file_exists($path))
|
||||
@@ -1610,16 +1607,19 @@ class ToolsCore
|
||||
if ($disable_multiviews)
|
||||
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
|
||||
|
||||
fwrite($write_fd, "RewriteEngine on\n\n");
|
||||
foreach ($domains as $domain => $list_uri)
|
||||
foreach ($list_uri as $uri)
|
||||
// Rewrite virtual multishop uri
|
||||
if ($uri['virtual'])
|
||||
{
|
||||
fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'/?$ '.$uri['physical'].$uri['virtual']."index.php [L,R]\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
||||
}
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
fwrite($write_fd, "RewriteEngine on\n\n");
|
||||
foreach ($domains as $domain => $list_uri)
|
||||
foreach ($list_uri as $uri)
|
||||
// Rewrite virtual multishop uri
|
||||
if ($uri['virtual'])
|
||||
{
|
||||
fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'/?$ '.$uri['physical'].$uri['virtual']."index.php [L,R]\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Webservice
|
||||
fwrite($write_fd, 'RewriteRule ^api/?(.*)$ '."webservice/dispatcher.php?url=$1 [QSA,L]\n\n");
|
||||
|
||||
@@ -61,7 +61,7 @@ class AdminControllerCore extends Controller
|
||||
public $id = -1;
|
||||
|
||||
/** @var array noTabLink array of admintab names which have no content */
|
||||
public $noTabLink = array('AdminCatalog', 'AdminTools', 'AdminStock', 'AdminAccounting');
|
||||
public $noTabLink = array('AdminCatalog', 'AdminPriceRule', 'AdminTools', 'AdminStock', 'AdminAdmin');
|
||||
|
||||
public $required_database = false;
|
||||
|
||||
@@ -1250,15 +1250,11 @@ class AdminControllerCore extends Controller
|
||||
$tabs[$index]['href'] = $this->context->link->getAdminLink($tab['class_name']);
|
||||
|
||||
$sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']);
|
||||
// Add parent tab to sub_tabs list
|
||||
array_unshift($sub_tabs, $tab);
|
||||
|
||||
foreach ($sub_tabs as $index2 => $sub_tab)
|
||||
{
|
||||
// class_name is the name of the class controller
|
||||
if (Tab::checkTabRights($sub_tab['id_tab']) === true
|
||||
&& (bool)$sub_tab['active']
|
||||
&& !in_array($sub_tab['class_name'], $this->noTabLink)) // check that tab is not in "do not display" list
|
||||
&& (bool)$sub_tab['active'])
|
||||
$sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']);
|
||||
else
|
||||
unset($sub_tabs[$index2]);
|
||||
|
||||
@@ -121,8 +121,6 @@ class HelperOptionsCore extends Helper
|
||||
}
|
||||
</script>';
|
||||
$field['link_remove_ip'] = '  <a href="#" class="button" onclick="addRemoteAddr(); return false;">'.$this->l('Add my IP', 'Helper').'</a>';
|
||||
if (!isset($category_data['bottom']))
|
||||
$category_data['bottom'] = '<script type="text/javascript">changeCMSActivationAuthorization();</script>';
|
||||
}
|
||||
|
||||
// Multishop default value
|
||||
|
||||
Reference in New Issue
Block a user