diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 861f83803..37b247b04 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -27,6 +27,9 @@ class AdminAccessController extends AdminController { + /* Black list of id_tab that do not have access */ + public $accesses_black_list = array(107); + public function __construct() { $this->table = 'access'; @@ -45,10 +48,17 @@ class AdminAccessController extends AdminController { $current_profile = (int)$this->getCurrentProfileId(); $profiles = Profile::getProfiles($this->context->language->id); + $tabs = Tab::getTabs($this->context->language->id); $accesses = array(); foreach ($profiles as $profile) $accesses[$profile['id_profile']] = Profile::getProfileAccesses($profile['id_profile']); + // Deleted id_tab that do not have access + foreach ($tabs as $key => $tab) + foreach ($this->accesses_black_list as $id_tab) + if ($tab['id_tab'] == (int)$id_tab) + unset($tabs[$key]); + $modules = array(); foreach ($profiles as $profile) $modules[$profile['id_profile']] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' @@ -64,7 +74,7 @@ class AdminAccessController extends AdminController $this->tpl_form_vars = array( 'profiles' => $profiles, 'accesses' => $accesses, - 'tabs' => Tab::getTabs($this->context->language->id), + 'tabs' => $tabs, 'current_profile' => (int)$current_profile, 'admin_profile' => (int)_PS_ADMIN_PROFILE_, 'access_edit' => $this->tabAccess['edit'], @@ -98,12 +108,12 @@ class AdminAccessController extends AdminController 'url_post' => self::$currentIndex.'&token='.$this->token, )); } - + public function ajaxProcessUpdateAccess() { if ($this->tabAccess['edit'] != '1') throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); - + if (Tools::isSubmit('submitAddAccess')) { $perm = Tools::getValue('perm'); @@ -151,13 +161,13 @@ class AdminAccessController extends AdminController die($res); } } - + public function ajaxProcessUpdateModuleAccess() { if ($this->tabAccess['edit'] != '1') throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); /* Update Access Modules */ - + if (Tools::isSubmit('changeModuleAccess')) { $perm = Tools::getValue('perm'); diff --git a/install-dev/index.php b/install-dev/index.php index 8f8821498..29bd515d6 100644 --- a/install-dev/index.php +++ b/install-dev/index.php @@ -37,7 +37,7 @@ if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '') if ($tmp = strpos($_SERVER['REQUEST_URI'], '?')) $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $tmp); -define('INSTALL_VERSION', '1.5.0.1'); +define('INSTALL_VERSION', '1.5.0.2'); define('MINIMUM_VERSION_TO_UPDATE', '0.8.5'); define('INSTALL_PATH', dirname(__FILE__)); if (version_compare(phpversion(), '5.0.0', '<')) diff --git a/install-dev/model.php b/install-dev/model.php index 16c43f69d..01fa0ab85 100644 --- a/install-dev/model.php +++ b/install-dev/model.php @@ -63,7 +63,7 @@ if ($tmp = strpos($_SERVER['REQUEST_URI'], '?')) $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $tmp); $_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']); -define('INSTALL_VERSION', '1.5.0.1'); +define('INSTALL_VERSION', '1.5.0.2'); define('PS_INSTALLATION_IN_PROGRESS', true); require_once(INSTALL_PATH.'/classes/ToolsInstall.php'); define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php'); diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index 43e5d72f4..450e5ebf2 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -969,6 +969,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (3, 104, 1, 1, 1, 1), (3, 105, 0, 0, 0, 0), (3, 106, 0, 0, 0, 0), +(3, 108, 1, 1, 1, 1), (4, 1, 1, 1, 1, 1), (4, 2, 0, 0, 0, 0), (4, 3, 0, 0, 0, 0), @@ -1066,6 +1067,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (4, 104, 1, 1, 1, 1), (4, 105, 1, 1, 1, 1), (4, 106, 1, 1, 1, 1), +(4, 108, 0, 0, 0, 0), (5, 1, 1, 1, 1, 1), (5, 2, 1, 1, 1, 1), (5, 3, 1, 1, 1, 1), @@ -1162,7 +1164,8 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (5, 103, 1, 1, 1, 1), (5, 104, 1, 1, 1, 1), (5, 105, 0, 0, 0, 0), -(5, 106, 0, 0, 0, 0); +(5, 106, 0, 0, 0, 0), +(5, 108, 0, 0, 0, 0); INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module); INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module); diff --git a/install-dev/sql/upgrade/1.5.0.2.sql b/install-dev/sql/upgrade/1.5.0.2.sql new file mode 100644 index 000000000..2c5815907 --- /dev/null +++ b/install-dev/sql/upgrade/1.5.0.2.sql @@ -0,0 +1,7 @@ +SET NAMES 'utf8'; + +INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('1', '108', '1', '1', '1', '1'); +INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('2', '108', '1', '1', '1', '1'); +INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('3', '108', '1', '1', '1', '1'); +INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('4', '108', '0', '0', '0', '0'); +INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('5', '108', '0', '0', '0', '0'); \ No newline at end of file