fix: [internal] Check if user is logged before checking if he is site admin

pull/5924/head
Jakub Onderka 2020-05-19 17:11:39 +02:00
parent df1ed1badf
commit 8c13330712
1 changed files with 2 additions and 3 deletions

View File

@ -508,9 +508,8 @@ class AppController extends Controller
} else {
$this->set('me', false);
}
$this->set('br', '<br />');
$this->set('bold', array('<span class="bold">', '</span>'));
if ($this->_isSiteAdmin()) {
if ($this->Auth->user() && $this->_isSiteAdmin()) {
if (Configure::read('Session.defaults') == 'database') {
$db = ConnectionManager::getDataSource('default');
$sqlResult = $db->query('SELECT COUNT(id) AS session_count FROM cake_sessions WHERE expires < ' . time() . ';');