chg: [app] Generate side menu for logged-in users only

pull/72/head
Sami Mokaddem 2021-10-08 16:45:56 +02:00
parent 39fdb8ec0d
commit 13d546fd2a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 2 deletions

View File

@ -102,7 +102,7 @@ class AppController extends Controller
$this->ACL->setPublicInterfaces();
if (!empty($this->request->getAttribute('identity'))) {
$user = $this->Users->get($this->request->getAttribute('identity')->getIdentifier(), [
'contain' => ['Roles', 'Individuals' => 'Organisations']
'contain' => ['Roles', 'Individuals' => 'Organisations', 'UserSettings']
]);
if (!empty($user['disabled'])) {
$this->Authentication->logout();
@ -112,6 +112,8 @@ class AppController extends Controller
unset($user['password']);
$this->ACL->setUser($user);
$this->isAdmin = $user['role']['perm_admin'];
$this->set('menu', $this->ACL->getMenu());
$this->set('loggedUser', $this->ACL->getUser());
} else if ($this->ParamHandler->isRest()) {
throw new MethodNotAllowedException(__('Invalid user credentials.'));
}
@ -126,7 +128,6 @@ class AppController extends Controller
}
$this->ACL->checkAccess();
$this->set('menu', $this->ACL->getMenu());
$this->set('breadcrumb', $this->Navigation->getBreadcrumb());
$this->set('ajax', $this->request->is('ajax'));
$this->request->getParam('prefix');