Ejemplo n.º 1
0
 public static function validatePageAccess(sfAction $action, $page)
 {
     $action->forward404Unless($page);
     if (!$page->userHasPrivilege('view')) {
         // forward rather than login because referrers don't always
         // work. Hopefully the login action will capture the original
         // URI to bring the user back here afterwards.
         if ($action->getUser()->isAuthenticated()) {
             return $action->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
         } else {
             return $action->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action'));
         }
     }
     if ($page->archived && !$page->userHasPrivilege('edit|manage')) {
         $action->forward404();
     }
 }