Exemple #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("/");
     }
 }
Exemple #2
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 = str_replace(USVN_URL_SEP, '/', $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;
     $this->view->isAdmin = $this->isAdmin();
     $user = $this->getRequest()->getParam('user');
     $this->view->user = $user;
     $this->view->secret_id = $user->secret_id;
     /* @var $user USVN_Db_Table_Row_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("/");
     }
     if (strlen($project->name) > 12) {
         $shortName = substr($project->name, 0, 12) . '..';
     } else {
         $shortName = $project->name;
     }
     $this->view->submenu = array(array('label' => $shortName), array('label' => 'Index', 'url' => array('action' => '', 'project' => $project->name), 'route' => 'project'), array('label' => 'Timeline', 'url' => array('action' => 'timeline', 'project' => $project->name), 'route' => 'project'), array('label' => 'Browser', 'url' => array('action' => 'browser', 'project' => $project->name), 'route' => 'project'));
 }
Exemple #3
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();
     $user = $this->getRequest()->getParam('user');
     if (!$user || !$user->is_admin) {
         $this->_redirect("/");
     }
     $this->view->submenu = array(array('label' => 'Admin'), array('label' => 'Users', 'route' => 'admin', 'url' => array('action' => '', 'controller' => 'user')), array('label' => 'Groups', 'route' => 'admin', 'url' => array('action' => '', 'controller' => 'group')), array('label' => 'Projects', 'route' => 'admin', 'url' => array('action' => '', 'controller' => 'project')), array('label' => 'Configuration', 'route' => 'admin', 'url' => array('action' => '', 'controller' => 'config')), array('label' => 'System report', 'route' => 'admin', 'url' => array('action' => '', 'controller' => 'systemreport')));
 }
Exemple #4
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();
     $group_name = str_replace(USVN_URL_SEP, '/', $this->getRequest()->getParam('group'));
     $table = new USVN_Db_Table_Groups();
     $group = $table->fetchRow(array("groups_name = ?" => $group_name));
     $identity = Zend_Auth::getInstance()->getIdentity();
     $table = new USVN_Db_Table_Users();
     $this->view->user = $table->fetchRow(array("users_login = ?" => $identity['username']));
     $this->_group = $group;
     if (!$group->hasUser($this->view->user) && $this->view->user->is_admin != 1) {
         //throw new USVN_Exception();
         $this->view->message = T_("Access denied.");
         $this->render('error');
     }
 }
Exemple #5
0
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_helper->layout()->disableLayout();
 }
 public function postDispatch()
 {
     echo "</files>";
     parent::postDispatch();
 }