/**
  * 添加规则
  */
 public function addAction()
 {
     if ($this->_request->isPost()) {
         try {
             $this->rule->add($this->_request->getPost());
             $cache = Zend_Registry::get('cache');
             $cache->remove('acl_resource');
             // 删除缓存
             $this->_redirect($this->view->url(array('action' => 'list')));
         } catch (Exception $e) {
             $this->view->feedback(array('title' => '发生错误', 'message' => '操作失败:' . $e->getMessage()));
         }
     }
     $this->view->layout = array('title' => '管理后台 - 添加规则');
     $this->view->privileges = $this->privilege->getAll();
 }
 /**
  * 追加权限
  * @param  string  $resName
  * @param  string  $privName
  * @throws EGP_Exception
  */
 public function append($resName, $privName)
 {
     if (!$this->resExists($resName)) {
         throw new Zend_Exception("资源 '{$resName}' 不存在或者已经被删除");
     }
     $privilege = new PrivilegeModel();
     if (!$privilege->exists($privName)) {
         throw new Zend_Exception("权限 '{$privName}' 不存在或者已经被删除");
     }
     if ($this->resHasPriv($resName, $privName)) {
         throw new Zend_Exception("资源 '{$resName}' 下已经存在 '{$privName}' 这个权限了");
     }
     $this->_add($resName, $privName);
 }
 /**
  * 删除权限
  */
 public function delAction()
 {
     $this->privilege->del($this->_request->getParam('priv_name'));
     $this->_redirect($this->view->url(array('module' => 'admin', 'controller' => 'privilege', 'action' => 'list'), '', true));
     $this->isload = false;
 }