fix: [API] fixed broken API
- don't call functions specifically meant for the UI when in an ACL context - also fixed breaking issues with the loggingpull/79/head
parent
92fee87a7f
commit
bacb3dc85e
|
@ -113,8 +113,10 @@ class AppController extends Controller
|
||||||
$this->ACL->setUser($user);
|
$this->ACL->setUser($user);
|
||||||
$this->request->getSession()->write('authUser', $user);
|
$this->request->getSession()->write('authUser', $user);
|
||||||
$this->isAdmin = $user['role']['perm_admin'];
|
$this->isAdmin = $user['role']['perm_admin'];
|
||||||
|
if (!$this->ParamHandler->isRest()) {
|
||||||
$this->set('menu', $this->ACL->getMenu());
|
$this->set('menu', $this->ACL->getMenu());
|
||||||
$this->set('loggedUser', $this->ACL->getUser());
|
$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.'));
|
||||||
}
|
}
|
||||||
|
@ -153,9 +155,8 @@ class AppController extends Controller
|
||||||
if (!empty($authKey)) {
|
if (!empty($authKey)) {
|
||||||
$this->loadModel('Users');
|
$this->loadModel('Users');
|
||||||
$user = $this->Users->get($authKey['user_id']);
|
$user = $this->Users->get($authKey['user_id']);
|
||||||
$user = $logModel->userInfo();
|
|
||||||
$logModel->insert([
|
$logModel->insert([
|
||||||
'action' => 'login',
|
'request_action' => 'login',
|
||||||
'model' => 'Users',
|
'model' => 'Users',
|
||||||
'model_id' => $user['id'],
|
'model_id' => $user['id'],
|
||||||
'model_title' => $user['username'],
|
'model_title' => $user['username'],
|
||||||
|
@ -167,7 +168,7 @@ class AppController extends Controller
|
||||||
} else {
|
} else {
|
||||||
$user = $logModel->userInfo();
|
$user = $logModel->userInfo();
|
||||||
$logModel->insert([
|
$logModel->insert([
|
||||||
'action' => 'login',
|
'request_action' => 'login',
|
||||||
'model' => 'Users',
|
'model' => 'Users',
|
||||||
'model_id' => $user['id'],
|
'model_id' => $user['id'],
|
||||||
'model_title' => $user['name'],
|
'model_title' => $user['name'],
|
||||||
|
|
Loading…
Reference in New Issue