Wednesday, September 2, 2009

Routing Help

I am having some problem with adding additional administrative routing to my app.
 
I have
Configure::write('Routing.admin', 'admin');
 
Log in as admin and all the urls have /admin/ in front of the controller and action and works perfect (did not have to add any Router::connect custom routing)

I added
Configure::write('Routing.manage', 'manage'); to core.php,
added the correct manage_actions to the controllers with the corresponding  manage_action views but all the link point to controller/action.
Logged in as a normal user and there is no manage prefix added like the admin did automatically.
 
I manually type in manage/gallery/index and hover over "add" and it points to gallery/add not manage/gallery/add which it should
 
Does the admin work automatically because its built into Cake and I have to manually create routing for my manage_ functions? If not why is it working for admin and not manage?
 
I have read thru the cookbook http://book.cakephp.org/view/544/Prefix-Routing and can get the manage to work by adding my own Router::connect  but seems like overkill to go thru link by link and adding prefix => manage to every link in the app when admin needed no changes to the code.
 
Can someone point out what I may be missing or did wrong?
 
In my app_controller I have
 
function beforeFilter()
      {
  
 
          $admin = Configure::read('Routing.admin');
          if (isset($this->params[$admin]) && $this->params[$admin]) {
              $this->__checkAdminSession();
              $this->layout = 'admin';
          }
    $manage = Configure::read('Routing.manage');
          if (isset($this->params[$manage]) && $this->params[$manage]) {
              $this->__checkUserSession();
              $this->layout = 'manage';
          }
        
          $this->Auth->actionPath = 'controllers/';
          $this->Auth->authorize = 'actions';
          //$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
          //$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
          //$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index');
          $this->Auth->userScope = array('User.confirmed' => '1');
          $this->Auth->autoRedirect = false;
   
   
      }
 
 
Thanks
 
Dave

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: