// Changes to BO permissions management
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12366 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -28,8 +28,6 @@
|
||||
class AdminControllerCore extends Controller
|
||||
{
|
||||
public $path;
|
||||
|
||||
|
||||
public static $currentIndex;
|
||||
public $content;
|
||||
public $warnings = array();
|
||||
@@ -1860,9 +1858,8 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
else if (isset($_GET['update'.$this->table]) && isset($_GET['id_'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
$this->display = 'edit';
|
||||
else
|
||||
$this->display = 'edit';
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (isset($_GET['view'.$this->table]))
|
||||
|
||||
@@ -79,6 +79,11 @@ abstract class ControllerCore
|
||||
*/
|
||||
abstract public function checkAccess();
|
||||
|
||||
/**
|
||||
* check that the current user/visitor has valid view permissions
|
||||
*/
|
||||
abstract public function viewAccess();
|
||||
|
||||
/**
|
||||
* Initialize the page
|
||||
*/
|
||||
@@ -141,7 +146,6 @@ abstract class ControllerCore
|
||||
public function run()
|
||||
{
|
||||
$this->init();
|
||||
|
||||
if ($this->checkAccess())
|
||||
{
|
||||
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
||||
@@ -156,7 +160,10 @@ abstract class ControllerCore
|
||||
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
||||
$this->initHeader();
|
||||
|
||||
$this->initContent();
|
||||
if ($this->viewAccess())
|
||||
$this->initContent();
|
||||
else
|
||||
$this->errors[] = Tools::displayError('Access denied.');
|
||||
|
||||
if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))
|
||||
$this->initFooter();
|
||||
|
||||
@@ -69,15 +69,25 @@ class FrontControllerCore extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* checkAccess
|
||||
* @see Controller::checkAccess()
|
||||
*
|
||||
* @return void
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkAccess()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Controller::viewAccess
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function viewAccess()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user