// added 1.5.0.2 version in install script + fix deleted Adminlogin accesses

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10762 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-29 17:47:14 +00:00
parent 2abd646ca4
commit f787bbd3e6
5 changed files with 28 additions and 8 deletions
+15 -5
View File
@@ -27,6 +27,9 @@
class AdminAccessController extends AdminController class AdminAccessController extends AdminController
{ {
/* Black list of id_tab that do not have access */
public $accesses_black_list = array(107);
public function __construct() public function __construct()
{ {
$this->table = 'access'; $this->table = 'access';
@@ -45,10 +48,17 @@ class AdminAccessController extends AdminController
{ {
$current_profile = (int)$this->getCurrentProfileId(); $current_profile = (int)$this->getCurrentProfileId();
$profiles = Profile::getProfiles($this->context->language->id); $profiles = Profile::getProfiles($this->context->language->id);
$tabs = Tab::getTabs($this->context->language->id);
$accesses = array(); $accesses = array();
foreach ($profiles as $profile) foreach ($profiles as $profile)
$accesses[$profile['id_profile']] = Profile::getProfileAccesses($profile['id_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(); $modules = array();
foreach ($profiles as $profile) foreach ($profiles as $profile)
$modules[$profile['id_profile']] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' $modules[$profile['id_profile']] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -64,7 +74,7 @@ class AdminAccessController extends AdminController
$this->tpl_form_vars = array( $this->tpl_form_vars = array(
'profiles' => $profiles, 'profiles' => $profiles,
'accesses' => $accesses, 'accesses' => $accesses,
'tabs' => Tab::getTabs($this->context->language->id), 'tabs' => $tabs,
'current_profile' => (int)$current_profile, 'current_profile' => (int)$current_profile,
'admin_profile' => (int)_PS_ADMIN_PROFILE_, 'admin_profile' => (int)_PS_ADMIN_PROFILE_,
'access_edit' => $this->tabAccess['edit'], 'access_edit' => $this->tabAccess['edit'],
@@ -98,12 +108,12 @@ class AdminAccessController extends AdminController
'url_post' => self::$currentIndex.'&token='.$this->token, 'url_post' => self::$currentIndex.'&token='.$this->token,
)); ));
} }
public function ajaxProcessUpdateAccess() public function ajaxProcessUpdateAccess()
{ {
if ($this->tabAccess['edit'] != '1') if ($this->tabAccess['edit'] != '1')
throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); throw new PrestashopException(Tools::displayError('You do not have permission to edit here.'));
if (Tools::isSubmit('submitAddAccess')) if (Tools::isSubmit('submitAddAccess'))
{ {
$perm = Tools::getValue('perm'); $perm = Tools::getValue('perm');
@@ -151,13 +161,13 @@ class AdminAccessController extends AdminController
die($res); die($res);
} }
} }
public function ajaxProcessUpdateModuleAccess() public function ajaxProcessUpdateModuleAccess()
{ {
if ($this->tabAccess['edit'] != '1') if ($this->tabAccess['edit'] != '1')
throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); throw new PrestashopException(Tools::displayError('You do not have permission to edit here.'));
/* Update Access Modules */ /* Update Access Modules */
if (Tools::isSubmit('changeModuleAccess')) if (Tools::isSubmit('changeModuleAccess'))
{ {
$perm = Tools::getValue('perm'); $perm = Tools::getValue('perm');
+1 -1
View File
@@ -37,7 +37,7 @@ if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '')
if ($tmp = strpos($_SERVER['REQUEST_URI'], '?')) if ($tmp = strpos($_SERVER['REQUEST_URI'], '?'))
$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $tmp); $_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('MINIMUM_VERSION_TO_UPDATE', '0.8.5');
define('INSTALL_PATH', dirname(__FILE__)); define('INSTALL_PATH', dirname(__FILE__));
if (version_compare(phpversion(), '5.0.0', '<')) if (version_compare(phpversion(), '5.0.0', '<'))
+1 -1
View File
@@ -63,7 +63,7 @@ if ($tmp = strpos($_SERVER['REQUEST_URI'], '?'))
$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $tmp); $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, $tmp);
$_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']); $_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); define('PS_INSTALLATION_IN_PROGRESS', true);
require_once(INSTALL_PATH.'/classes/ToolsInstall.php'); require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php'); define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php');
+4 -1
View File
@@ -969,6 +969,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 104, 1, 1, 1, 1), (3, 104, 1, 1, 1, 1),
(3, 105, 0, 0, 0, 0), (3, 105, 0, 0, 0, 0),
(3, 106, 0, 0, 0, 0), (3, 106, 0, 0, 0, 0),
(3, 108, 1, 1, 1, 1),
(4, 1, 1, 1, 1, 1), (4, 1, 1, 1, 1, 1),
(4, 2, 0, 0, 0, 0), (4, 2, 0, 0, 0, 0),
(4, 3, 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, 104, 1, 1, 1, 1),
(4, 105, 1, 1, 1, 1), (4, 105, 1, 1, 1, 1),
(4, 106, 1, 1, 1, 1), (4, 106, 1, 1, 1, 1),
(4, 108, 0, 0, 0, 0),
(5, 1, 1, 1, 1, 1), (5, 1, 1, 1, 1, 1),
(5, 2, 1, 1, 1, 1), (5, 2, 1, 1, 1, 1),
(5, 3, 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, 103, 1, 1, 1, 1),
(5, 104, 1, 1, 1, 1), (5, 104, 1, 1, 1, 1),
(5, 105, 0, 0, 0, 0), (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 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); INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
+7
View File
@@ -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');