public function indexAction() { $auth = Zend_Auth::getInstance(); $result = $auth->getStorage()->read(); if ($result->role == 'admin') { $role = true; } else { $role = false; } $dao = new Application_Model_UserDAO(); if ($result->role != 'admin') { $find[] = $dao->find($result->id); $this->view->lista = $find; } else { $this->view->lista = $dao->fetchAll(); } $this->view->role = $role; }
public function indexAction() { $id = $this->_request->getParam('id'); if (isset($id)) { $auth = Zend_Auth::getInstance(); $result = $auth->getStorage()->read(); $dao = new Application_Model_UserDAO(); $user = $dao->find($id); if ($result->id == $id) { $this->view->user = $user; } else { if ($result->role == 'admin') { $this->view->user = $user; } else { return $this->_redirector->gotoUrl('/listar'); } } } }