getUser(); return $this->response->html($this->helper->layout->user('user_api_access/show', array( 'user' => $user, 'title' => t('API User Access'), ))); } public function generate() { $user = $this->getUser(); $this->checkCSRFParam(); $this->userModel->update(array( 'id' => $user['id'], 'api_access_token' => Token::getToken(), )); $this->renderResponse(); } public function remove() { $user = $this->getUser(); $this->checkCSRFParam(); $this->userModel->update(array( 'id' => $user['id'], 'api_access_token' => null, )); $this->renderResponse(); } protected function renderResponse() { if ($this->request->isAjax()) { $this->show(); } else { $this->response->redirect($this->helper->url->to('UserApiAccessController', 'show', array('user_id' => $user['id']))); } } }