chg: [app] Generate side menu for logged-in users only
parent
39fdb8ec0d
commit
13d546fd2a
|
@ -102,7 +102,7 @@ class AppController extends Controller
|
||||||
$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(), [
|
||||||
'contain' => ['Roles', 'Individuals' => 'Organisations']
|
'contain' => ['Roles', 'Individuals' => 'Organisations', 'UserSettings']
|
||||||
]);
|
]);
|
||||||
if (!empty($user['disabled'])) {
|
if (!empty($user['disabled'])) {
|
||||||
$this->Authentication->logout();
|
$this->Authentication->logout();
|
||||||
|
@ -112,6 +112,8 @@ class AppController extends Controller
|
||||||
unset($user['password']);
|
unset($user['password']);
|
||||||
$this->ACL->setUser($user);
|
$this->ACL->setUser($user);
|
||||||
$this->isAdmin = $user['role']['perm_admin'];
|
$this->isAdmin = $user['role']['perm_admin'];
|
||||||
|
$this->set('menu', $this->ACL->getMenu());
|
||||||
|
$this->set('loggedUser', $this->ACL->getUser());
|
||||||
} else if ($this->ParamHandler->isRest()) {
|
} else if ($this->ParamHandler->isRest()) {
|
||||||
throw new MethodNotAllowedException(__('Invalid user credentials.'));
|
throw new MethodNotAllowedException(__('Invalid user credentials.'));
|
||||||
}
|
}
|
||||||
|
@ -126,7 +128,6 @@ class AppController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ACL->checkAccess();
|
$this->ACL->checkAccess();
|
||||||
$this->set('menu', $this->ACL->getMenu());
|
|
||||||
$this->set('breadcrumb', $this->Navigation->getBreadcrumb());
|
$this->set('breadcrumb', $this->Navigation->getBreadcrumb());
|
||||||
$this->set('ajax', $this->request->is('ajax'));
|
$this->set('ajax', $this->request->is('ajax'));
|
||||||
$this->request->getParam('prefix');
|
$this->request->getParam('prefix');
|
||||||
|
|
Loading…
Reference in New Issue