From ed6c16aef8bbdd881983c59978ecafa2c75765b6 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Thu, 12 Jan 2012 14:47:03 +0000 Subject: [PATCH] // Fix "my preferences" permissions --- classes/AdminController.php | 2 -- controllers/admin/AdminEmployeesController.php | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/classes/AdminController.php b/classes/AdminController.php index 654af7b8f..0d7b89874 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -350,8 +350,6 @@ class AdminControllerCore extends Controller if ($disable) return true; - $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); - if ($this->tabAccess['view'] === '1') return true; return false; diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index a10f35436..9e4c99bbb 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -99,6 +99,13 @@ class AdminEmployeesControllerCore extends AdminController $this->themes[] = $theme; parent::__construct(); + + // An employee can edit its own profile + if ($this->context->employee->id == Tools::getValue('id_employee')) + { + $this->tabAccess['view'] = '1'; + $this->tabAccess['edit'] = '1'; + } } public function renderList() @@ -361,7 +368,7 @@ class AdminEmployeesControllerCore extends AdminController return parent::postProcess(); } - public function initProcess() + /*public function initProcess() { // If employee is editing its own entry, its ok if ($this->tabAccess['edit'] !== '1' @@ -371,6 +378,14 @@ class AdminEmployeesControllerCore extends AdminController $this->tabAccess['edit'] = 1; parent::initProcess(); + }*/ + + public function initContent() + { + if ($this->context->employee->id == Tools::getValue('id_employee')) + $this->display = 'edit'; + + return parent::initContent(); } }