fix: [settings] make sure they are always loaded

dependabot/npm_and_yarn/webroot/theme/braces-3.0.3
iglocska 2024-05-15 13:15:04 +02:00
parent eae074ef73
commit 4329b603a0
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 4 additions and 1 deletions

View File

@ -101,12 +101,15 @@ class AppController extends Controller
public function beforeFilter(EventInterface $event) public function beforeFilter(EventInterface $event)
{ {
$this->loadModel('Settings');
$this->Settings->loadSettings();
$this->loadModel('Users'); $this->loadModel('Users');
$this->Users->checkForNewInstance(); $this->Users->checkForNewInstance();
if ($this->ParamHandler->isRest()) { if ($this->ParamHandler->isRest()) {
$this->authApiUser(); $this->authApiUser();
$this->Security->setConfig('unlockedActions', [$this->request->getParam('action')]); $this->Security->setConfig('unlockedActions', [$this->request->getParam('action')]);
} }
$this->ACL->setPublicInterfaces(); $this->ACL->setPublicInterfaces();
if (!empty($this->request->getAttribute('identity'))) { if (!empty($this->request->getAttribute('identity'))) {
$user = $this->Users->get($this->request->getAttribute('identity')->getIdentifier(), [ $user = $this->Users->get($this->request->getAttribute('identity')->getIdentifier(), [

View File

@ -126,7 +126,7 @@ class SettingsTable extends AppTable
return $settings; return $settings;
} }
private function loadSettings(): void public function loadSettings(): void
{ {
$settings = file_get_contents(CONFIG . 'config.json'); $settings = file_get_contents(CONFIG . 'config.json');
$settings = json_decode($settings, true); $settings = json_decode($settings, true);