namespace App\Controller\Api\V1;
use App\Controller\AppController;
-use Cake\ORM\TableRegistry;
use Cake\Core\Configure;
+
/**
* Users Controller
*
return $this->redirect(['action' => 'index']);
}
-
-
- public function login()
- {
- if ($this->request->is('post')) {
- $user = $this->Auth->identify();
- if ($user) {
- $this->Auth->setUser($user);
- $this->set(compact('user'));
- $this->set('_serialize', ['user']);
- // return $this->redirect($this->Auth->redirectUrl());
- }else{
- $this->Flash->error(__('Invalid username or password, please try again'));
- }
- }
-
- }
-
public function logout()
{
return $this->redirect($this->Auth->logout());
*/
public function isAuthorized($user)
{
- if ($this->Users->isAdministration($user['id'])) $this->Auth->allow('addReview');
+ if($this->Auth->user()){
+ return true;
+ }
return parent::isAuthorized($user);
}
*/
public function beforeFilter(\Cake\Event\Event $event)
{
+ $this->Auth->allow('add','digest');
parent::beforeFilter($event);
-
-
- $this->Auth->allow('login','isAdministration');
}
}