* [ADD] Config module. Work in progress

This commit is contained in:
nuxsmin
2018-02-19 01:51:36 +01:00
parent eda5af40c7
commit faffe5495b
84 changed files with 3955 additions and 683 deletions

View File

@@ -28,6 +28,7 @@ use DI\Container;
use Interop\Container\ContainerInterface;
use Klein\Klein;
use SP\Config\Config;
use SP\Core\Acl\Acl;
use SP\Core\Events\EventDispatcher;
use SP\Core\Session\Session;
use SP\Core\UI\Theme;
@@ -74,6 +75,10 @@ abstract class SimpleControllerBase
* @var ContainerInterface
*/
protected $dic;
/**
* @var Acl
*/
protected $acl;
/**
* SimpleControllerBase constructor.
@@ -95,6 +100,7 @@ abstract class SimpleControllerBase
$this->theme = $this->dic->get(Theme::class);
$this->eventDispatcher = $this->dic->get(EventDispatcher::class);
$this->router = $this->dic->get(Klein::class);
$this->acl = $this->dic->get(Acl::class);
if (method_exists($this, 'initialize')) {
$this->initialize();
@@ -109,4 +115,15 @@ abstract class SimpleControllerBase
$this->checkLoggedInSession($this->session);
$this->checkSecurityToken($this->session);
}
/**
* Comprobar si está permitido el acceso al módulo/página.
*
* @param null $action La acción a comprobar
* @return bool
*/
protected function checkAccess($action)
{
return $this->session->getUserData()->getIsAdminApp() || $this->acl->checkUserAccess($action);
}
}