예제 #1
0
 /**
  * Pre-dispatch routines
  *
  * Called before action method. If using class with
  * {@link Zend_Controller_Front}, it may modify the
  * {@link $_request Request object} and reset its dispatched flag in order
  * to skip processing the current action.
  *
  * @return void
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $project = $this->getRequest()->getParam('project');
     $table = new USVN_Db_Table_Projects();
     $project = $table->fetchRow(array("projects_name = ?" => $project));
     /* @var $project USVN_Db_Table_Row_Project */
     if ($project === null) {
         $this->_redirect("/");
     }
     $this->_project = $project;
     $table = new USVN_Db_Table_Users();
     $user = $table->findBySecret($_GET['secret']);
     if ($user) {
         $groups = $user->findManyToManyRowset("USVN_Db_Table_Groups", "USVN_Db_Table_UsersToGroups");
         $find = false;
         foreach ($groups as $group) {
             if ($project->groupIsMember($group)) {
                 $find = true;
                 break;
             }
         }
         if (!$find && !$this->isAdmin()) {
             $this->_redirect("/");
         }
     } else {
         $this->_redirect("/");
     }
 }