protected function checkAclForNavigation(Zend_Navigation_Container $navigation)
 {
     $accessConfig = Zend_Registry::get('config')->access;
     $pages = $navigation->getPages();
     foreach ($pages as $page) {
         $controller = $page->get('controller');
         $action = $page->get('action');
         $allowed = Infra_AclHelper::isAllowed($controller, $action);
         if (!$allowed) {
             $navigation->removePage($page);
         } else {
             $this->checkAclForNavigation($page);
         }
         if ($action == 'dynamic_action') {
             $localPages = $page->getPages();
             $firstPage = reset($localPages);
             if ($firstPage) {
                 $firstPageAction = $firstPage->get('action');
                 $page->set('action', $firstPageAction);
             }
         }
     }
 }
 /**
  * Sets parent container
  *
  * @param  Zend_Navigation_Container $parent  [optional] new parent to set.
  *                                            Default is null which will set
  *                                            no parent.
  * @return Zend_Navigation_Page               fluent interface, returns self
  */
 public function setParent(Zend_Navigation_Container $parent = null)
 {
     if ($parent === $this) {
         // require_once 'Zend/Navigation/Exception.php';
         throw new Zend_Navigation_Exception('A page cannot have itself as a parent');
     }
     // return if the given parent already is parent
     if ($parent === $this->_parent) {
         return $this;
     }
     // remove from old parent
     if (null !== $this->_parent) {
         $this->_parent->removePage($this);
     }
     // set new parent
     $this->_parent = $parent;
     // add to parent if page and not already a child
     if (null !== $this->_parent && !$this->_parent->hasPage($this, false)) {
         $this->_parent->addPage($this);
     }
     return $this;
 }
Exemple #3
0
 protected function checkAclForNavigation(Zend_Navigation_Container $navigation)
 {
     $accessConfig = Zend_Registry::get('config')->access;
     $pages = $navigation->getPages();
     foreach ($pages as $page) {
         $controller = $page->get('controller');
         $action = $page->get('action');
         $allowed = Kaltura_AclHelper::isAllowed($controller, $action);
         if (!$allowed) {
             $navigation->removePage($page);
         } else {
             $this->checkAclForNavigation($page);
         }
     }
 }