app/controllers/backend/UserController.php: adding impersonateAction()
This commit is contained in:
parent
ca6067e48c
commit
7975a4da90
1 changed files with 14 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ class UserController extends \Phalcon\Mvc\Controller
|
|||
*/
|
||||
public function indexAction($page = 1)
|
||||
{
|
||||
$paginator = User::getPaginationList($page,15);
|
||||
$paginator = User::getPaginationList($page, 15);
|
||||
|
||||
$this->view->pagination_url = '/admin/user/list/';
|
||||
$this->view->page = $paginator->paginate();
|
||||
|
|
@ -113,4 +113,17 @@ class UserController extends \Phalcon\Mvc\Controller
|
|||
}
|
||||
$this->response->redirect('/admin');
|
||||
}
|
||||
|
||||
public function impersonateAction($id)
|
||||
{
|
||||
$user = User::findFirstById($id);
|
||||
|
||||
try {
|
||||
$this->auth->impersonate($user);
|
||||
$this->response->redirect('/');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flash->error($ex->getMessage());
|
||||
$this->response->redirect('/admin');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue