Пример #1
0
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $resource = $request->getControllerName();
     $action = $request->getActionName();
     $identity = $this->_auth->getStorage()->read();
     $role = $identity ? $identity->role_id : null;
     //get RoleName from role id
     $roletbl = new App_Model_Role();
     $rolesmapper = new App_Model_RoleMapper($roletbl);
     $row = $rolesmapper->find($role, $roletbl);
     $role = $roletbl->getRole();
     if (!$this->_acl->isAllowed($role, $resource, $action)) {
         $request->setControllerName('user')->setActionName('login');
     }
 }
Пример #2
0
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     $this->view->title = "Delete Role ";
     $this->view->headTitle($this->view->title);
     if ($this->getRequest()->isPost()) {
         $del = $this->getRequest()->getPost('del');
         if ($del == 'Yes') {
             $id = $this->getRequest()->getPost('id');
             $tbl = new App_Model_Role();
             $mapper = new App_Model_RoleMapper();
             $row = $tbl->find($id);
             $mapper->delete($tbl);
         }
         $this->_helper->redirector('index');
     } else {
         $tbl = new App_Model_Role();
         $this->view->id = $id;
     }
 }
Пример #3
0
 public function find($id)
 {
     $mapper = new App_Model_RoleMapper();
     $mapper->find($id, $this);
 }