[-] BO : #PSFV-608 - "Access denied" message in BO when login as Logistician

This commit is contained in:
vAugagneur
2012-03-12 14:15:31 +00:00
parent 98708ac408
commit 526301f67d
7 changed files with 47 additions and 5 deletions
@@ -41,6 +41,15 @@
>{$option|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
{elseif $input.type == 'default_tab'}
<select name="{$input.name}" id="{$input.name}">
{foreach $input.options AS $option}
<optgroup label="{$option.name|escape:'htmlall':'UTF-8'}"></optgroup>
{foreach $option.children AS $children}
<option value="{$children.id_tab}" {if $fields_value[$input.name] == $children.id_tab}selected="selected"{/if}>&nbsp;&nbsp;{$children.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
{/foreach}
</select>
{else}
{$smarty.block.parent}
{/if}
@@ -59,7 +59,9 @@
</div>
<div>
<div id="submit">
<input type="hidden" name="redirect" value="{$redirect}"/>
{if isset($redirect)}
<input type="hidden" name="redirect" value="{$redirect}"/>
{/if}
<input type="submit" name="submitLogin" value="{l s='Log in'}" class="button" style="float:left"/>
<span style="float:left;width:30px">
<img id="ajax-loader" src="../img/loader.gif" style="float:left;margin:2px 0 0 5px;display:none">
+3
View File
@@ -56,6 +56,8 @@ class EmployeeCore extends ObjectModel
/** @var string Display back office background in the specified color */
public $bo_color;
public $default_tab;
/** @var string employee's chosen theme */
public $bo_theme;
@@ -86,6 +88,7 @@ class EmployeeCore extends ObjectModel
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'bo_show_screencast' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
@@ -33,6 +33,9 @@ class AdminEmployeesControllerCore extends AdminController
/** @var array themes list*/
private $themes = array();
/** @var array tabs list*/
private $tabs_list = array();
public function __construct()
{
$this->table = 'employee';
@@ -111,6 +114,21 @@ class AdminEmployeesControllerCore extends AdminController
if (file_exists($path.$theme.'/css/admin.css'))
$this->themes[] = $theme;
$home_tab = Tab::getInstanceFromClassName('adminHome');
$this->tabs_list[$home_tab->id] = array(
'name' => $home_tab->name[$this->context->language->id],
'id_tab' => $home_tab->id,
'children' => array(array('id_tab' =>$home_tab->id, 'name' => $home_tab->name[$this->context->language->id])));
foreach (Tab::getTabs($this->context->language->id, 0) as $tab)
{
if (Tab::checkTabRights($tab['id_tab']))
{
$this->tabs_list[$tab['id_tab']] = $tab;
foreach (Tab::getTabs($this->context->language->id, $tab['id_tab']) as $children)
if (Tab::checkTabRights($children['id_tab']))
$this->tabs_list[$tab['id_tab']]['children'][] = $children;
}
}
parent::__construct();
// An employee can edit its own profile
@@ -188,6 +206,13 @@ class AdminEmployeesControllerCore extends AdminController
'size' => 20,
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")'
),
array(
'type' => 'default_tab',
'label' => $this->l('Default tab'),
'name' => 'default_tab',
'desc' => $this->l('This tab will be displayed just after login'),
'options' => $this->tabs_list
),
array(
'type' => 'text',
'label' => $this->l('Back office width'),
+5 -4
View File
@@ -78,7 +78,7 @@ class AdminLoginControllerCore extends AdminController
// Redirect to admin panel
if (isset($_GET['redirect']) && Validate::isControllerName($_GET['redirect']))
$redirect = $_GET['redirect'];
$this->context->smarty->assign(array('redirect' => Tools::getValue('redirect')));
if ($nbErrors = count($this->errors))
$this->context->smarty->assign(
@@ -89,8 +89,6 @@ class AdminLoginControllerCore extends AdminController
'disableDefaultErrorOutPut' => true,
)
);
$this->context->smarty->assign(array('redirect' => isset($redirect) ? $redirect : null));
$this->setMedia();
$this->initHeader();
parent::initContent();
@@ -161,7 +159,10 @@ class AdminLoginControllerCore extends AdminController
if (isset($_POST['redirect']) && Validate::isControllerName($_POST['redirect']))
$url = $this->context->link->getAdminLink($_POST['redirect']);
else
$url = $this->context->link->getAdminLink('AdminHome');
{
$tab = new Tab((int)$this->context->employee->default_tab);
$url = $this->context->link->getAdminLink($tab->class_name);
}
if (Tools::isSubmit('ajax'))
die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
+1
View File
@@ -693,6 +693,7 @@ CREATE TABLE `PREFIX_employee` (
`stats_date_to` date default NULL,
`bo_color` varchar(32) default NULL,
`bo_theme` varchar(32) default NULL,
`default_tab` int(10) unsigned NOT NULL DEFAULT 0,
`bo_width` int(10) unsigned NOT NULL DEFAULT 0,
`bo_show_screencast` tinyint(1) NOT NULL default '1',
`active` tinyint(1) unsigned NOT NULL default '0',
+1
View File
@@ -5,3 +5,4 @@ ALTER TABLE `PREFIX_employee`
MODIFY COLUMN `id_last_customer_message` INT(10) UNSIGNED NOT NULL DEFAULT 0,
MODIFY COLUMN `id_last_customer` INT(10) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `PREFIX_employee` ADD `default_tab` int(10) unsigned NOT NULL default 0 AFTER `bo_theme`;