diff options
author | daita <maxence@pontapreta.net> | 2017-02-08 02:30:22 +0300 |
---|---|---|
committer | daita <maxence@pontapreta.net> | 2017-02-08 02:30:22 +0300 |
commit | c3be81f90f59df137ba2c60d36601064f01a38c3 (patch) | |
tree | 94509c8ab10a720c6ef8113ce4fd806716534461 /lib | |
parent | 267fb614722ba1f4bf57a7d2fe7de586cf28cd0d (diff) |
setUserValue/getUserValue get the current userId
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 6 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 7 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 11 |
3 files changed, 11 insertions, 13 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 6adf19e..94e6a4c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -54,15 +54,15 @@ class Application extends App }); $container->registerService('ConfigService', function ($c) { - return new ConfigService($c->query('AppName'), $c->query('CoreConfig'), $c->query('MiscService')); + return new ConfigService($c->query('AppName'), $c->query('CoreConfig'), $c->query('UserId'), $c->query('MiscService')); }); $container->registerService('SettingsController', function ($c) { - return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('ConfigService'), $c->query('UserId'), $c->query('MiscService')); + return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('ConfigService'), $c->query('MiscService')); }); $container->registerService('OrcidController', function ($c) { - return new OrcidController($c->query('AppName'), $c->query('Request'), $c->query('ConfigService'), $c->query('UserId'), $c->query('MiscService')); + return new OrcidController($c->query('AppName'), $c->query('Request'), $c->query('ConfigService'), $c->query('MiscService')); }); /** diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 284a9c5..63f1bfb 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -37,15 +37,12 @@ class SettingsController extends Controller private $configService; - private $userId; - private $miscService; - public function __construct($appName, IRequest $request, ConfigService $configService, $userId, $miscService) + public function __construct($appName, IRequest $request, ConfigService $configService, $miscService) { parent::__construct($appName, $request); $this->configService = $configService; - $this->userId = $userId; $this->miscService = $miscService; } @@ -91,7 +88,7 @@ class SettingsController extends Controller { // 'orcid_token' => $this->configService->getUserValue($this->userId, 'orcid_token') $params = [ - 'orcid' => $this->configService->getUserValue($this->userId, 'orcid') + 'orcid' => $this->configService->getUserValue('orcid') ]; return new TemplateResponse($this->appName, 'settings.personal', $params, 'blank'); diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 300b3cd..64234ae 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -43,10 +43,11 @@ class ConfigService private $miscService; - public function __construct($appName, IConfig $config, $miscService) + public function __construct($appName, IConfig $config, $userId, $miscService) { $this->appName = $appName; $this->config = $config; + $this->userId = $userId; $this->miscService = $miscService; } @@ -94,9 +95,9 @@ class ConfigService * @param string $key * @return string */ - public function getUserValue($userId, $key) + public function getUserValue($key) { - return $this->config->getUserValue($userId, $this->appName, $key); + return $this->config->getUserValue($this->userId, $this->appName, $key); } /** @@ -107,9 +108,9 @@ class ConfigService * @param string $value * @return string */ - public function setUserValue($userId, $key, $value) + public function setUserValue($key, $value) { - return $this->config->setUserValue($userId, $this->appName, $key, $value); + return $this->config->setUserValue($this->userId, $this->appName, $key, $value); } /** |