// fix admin / superadmin rights

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11706 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-12-22 22:05:08 +00:00
parent f6e9488e74
commit 7038b2674b
2 changed files with 22 additions and 2 deletions
+17 -1
View File
@@ -110,6 +110,14 @@ class AdminEmployeesControllerCore extends AdminController
if (!($obj = $this->loadObject(true)))
return;
$available_profiles = Profile::getProfiles($this->context->language->id);
if ($obj->id_profile == _PS_ADMIN_PROFILE_ && $this->context->employee->id_profile != _PS_ADMIN_PROFILE_)
$this->_errors[] = Tools::displayError('You cannot edit SuperAdmin profile.');
return parent::renderForm();
$path = _PS_ADMIN_DIR_.'/themes/';
foreach (scandir($path) as $theme)
if (file_exists($path.$theme.'/admin.css'))
@@ -227,13 +235,21 @@ class AdminEmployeesControllerCore extends AdminController
'desc' => $this->l('Allow or disallow this employee to log into this Back Office')
);
// if employee is not SuperAdmin (id_profile = 1), don't make it possible to select the admin profile
if ($this->context->employee->id_profile != _PS_ADMIN_PROFILE_)
foreach ($available_profiles as $i => $profile)
if ($available_profile['id_profile'] == _PS_ADMIN_PROFILE_)
{
unset($available_profiles[$i]);
break;
}
$this->fields_form['input'][] = array(
'type' => 'select',
'label' => $this->l('Profile:'),
'name' => 'id_profile',
'required' => true,
'options' => array(
'query' => Profile::getProfiles($this->context->language->id),
'query' => $available_profiles,
'id' => 'id_profile',
'name' => 'name',
'default' => array(