public function up($params = false)
 {
     $modelResources = new Modules_Access_Model_Resources();
     $modelRules = new Modules_Access_Model_Rules();
     foreach ($this->_resources as $resource) {
         $modelResources->insert($resource);
         $modelRules->addRule($resource['resource_name'], 'admin', 'allow');
         $modelRules->addRule($resource['resource_name'], 'user', 'deny');
     }
     $modelRules->addRule('admin_module_dbmigrations', 'admin', 'deny');
     $modelRules->addRule('admin_module_guitestcase', 'admin', 'deny');
     $modelRules->addRule('admin_module_logger', 'admin', 'deny');
     $modelRules->addRule('admin_module_zfdebuginit', 'admin', 'deny');
     $modelRules->addRule('admin_module_search', 'admin', 'deny');
 }
 public function isValid($value)
 {
     $isValid = true;
     $request = Zend_Controller_Front::getInstance()->getRequest();
     if ($request->getParam('resource') || is_numeric($value) && Zend_Controller_Front::getInstance()->getRequest()->getParam('type') == 'free' || false == is_numeric($value) && $request->getParam('type') == 'router') {
         return true;
     }
     $resource_name = is_numeric($value) ? 'route_' . $value : $value;
     $model = new Modules_Access_Model_Resources();
     if (sizeof($model->getResource($resource_name))) {
         $this->_error(self::ERROR, $resource_name);
         $isValid = false;
     }
     return $isValid;
 }
 public function rulesbyroleAction()
 {
     $role_id = $this->getParam('role_id');
     if (sizeof($_POST)) {
         $this->_modelRules->removeRoleRules($role_id);
         foreach ($_POST as $resource_name => $access) {
             if ($resource_name == 'role_id') {
                 continue;
             }
             switch ($access) {
                 case 'allow':
                     $this->_modelRules->addRule($resource_name, $role_id, 'allow');
                     break;
                 case 'deny':
                     $this->_modelRules->addRule($resource_name, $role_id, 'deny');
                     break;
             }
         }
         Zetta_Acl::resetInstance();
     }
     $this->view->role_name = $role_id;
     $this->view->resources = $this->_modelResources->getResources(Zetta_Acl::getInstance()->getMyGroup());
 }