From 9b8ae149facbe9adf4e2bdee5aed62c64ab887cb Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Wed, 4 Jan 2017 15:20:58 +0100 Subject: [PATCH] * [DEV] New Plugin infraestructure (work in progress). --- inc/Plugins/Authenticator/ActionController.class.php | 7 +++++++ inc/Plugins/Authenticator/AuthenticatorPlugin.class.php | 2 +- inc/Plugins/Authenticator/PreferencesController.class.php | 2 +- inc/SP/Core/Acl.class.php | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/inc/Plugins/Authenticator/ActionController.class.php b/inc/Plugins/Authenticator/ActionController.class.php index 03f536fd..baaa886b 100644 --- a/inc/Plugins/Authenticator/ActionController.class.php +++ b/inc/Plugins/Authenticator/ActionController.class.php @@ -29,9 +29,11 @@ use SP\Controller\RequestControllerTrait; use SP\Core\Exceptions\SPException; use SP\Core\Plugin\PluginDataStore; use SP\Core\Session as CoreSession; +use SP\Core\Session; use SP\DataModel\PluginData; use SP\Http\Request; use SP\Mgmt\Plugins\Plugin; +use SP\Util\Checks; use SP\Util\Json; /** @@ -94,6 +96,11 @@ class ActionController implements ItemControllerInterface Json::returnJson($this->jsonResponse); } + if (Checks::demoIsEnabled()) { + $this->jsonResponse->setDescription(_('Ey, esto es una DEMO!!')); + Json::returnJson($this->jsonResponse); + } + try { $data = $this->Plugin->getData(); diff --git a/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php b/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php index b24089e3..e10dfdb4 100644 --- a/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php +++ b/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php @@ -54,7 +54,7 @@ class AuthenticatorPlugin extends PluginBase */ public function init() { - if ($this->data === null) { + if (!is_array($this->data)) { $this->data = []; } diff --git a/inc/Plugins/Authenticator/PreferencesController.class.php b/inc/Plugins/Authenticator/PreferencesController.class.php index f8de2abf..675301d2 100644 --- a/inc/Plugins/Authenticator/PreferencesController.class.php +++ b/inc/Plugins/Authenticator/PreferencesController.class.php @@ -66,7 +66,7 @@ class PreferencesController $base = $this->Plugin->getThemeDir() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'userpreferences'; // Datos del plugin - $pluginData = $this->Plugin->getData(); + $pluginData = $this->Plugin->getData() ?: []; // Datos del usuario de la sesión $UserData = $this->Controller->getUserData(); diff --git a/inc/SP/Core/Acl.class.php b/inc/SP/Core/Acl.class.php index 3c85a411..1f298234 100644 --- a/inc/SP/Core/Acl.class.php +++ b/inc/SP/Core/Acl.class.php @@ -135,6 +135,7 @@ class Acl implements ActionsInterface return ($curUserProfile->isMgmCategories() || $curUserProfile->isMgmCustomers()); case self::ACTION_CFG: return ($curUserProfile->isConfigGeneral() || $curUserProfile->isConfigEncryption() || $curUserProfile->isConfigBackup() || $curUserProfile->isConfigImport()); + case self::ACTION_MGM_PLUGINS: case self::ACTION_CFG_GENERAL: return $curUserProfile->isConfigGeneral(); case self::ACTION_CFG_IMPORT: