Exemplo n.º 1
0
 /**
  * Get the sections of the current extension's structure
  *
  * @param string $shownExtension
  * @param string $shownStructure
  * @return array the sections
  */
 private function getSections($shownExtension, $shownStructure)
 {
     $sections = array();
     $user = common_Session_SessionManager::getSession()->getUser();
     $structure = MenuService::getPerspective($shownExtension, $shownStructure);
     if (!is_null($structure)) {
         foreach ($structure->getChildren() as $section) {
             $resolver = new ActionResolver($section->getUrl());
             if (FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {
                 foreach ($section->getActions() as $action) {
                     $resolver = new ActionResolver($action->getUrl());
                     if (!FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {
                         $section->removeAction($action);
                     }
                 }
                 $sections[] = $section;
             }
         }
     }
     return $sections;
 }
 /**
  * Get the sections of the current extension's structure
  *
  * @param string $shownExtension
  * @param string $shownStructure
  * @return array the sections
  */
 private function getSections($shownExtension, $shownStructure)
 {
     $sections = array();
     $user = common_Session_SessionManager::getSession()->getUser();
     $structure = MenuService::getPerspective($shownExtension, $shownStructure);
     if (!is_null($structure)) {
         foreach ($structure->getChildren() as $section) {
             if (tao_models_classes_accessControl_AclProxy::hasAccess($section->getAction(), $section->getController(), $section->getExtensionId())) {
                 foreach ($section->getActions() as $action) {
                     $resolver = ActionResolver::getByControllerName($action->getController(), $action->getExtensionId());
                     if (!FuncProxy::accessPossible($user, $resolver->getController(), $action->getAction())) {
                         $section->removeAction($action);
                     }
                 }
                 $sections[] = $section;
             }
         }
     }
     return $sections;
 }