I thought the beforeFilter  was occuring in AppController - because you have
it in UsersController it wont ever get executed when you call admin because
admin actually uses the PagesController.

Move the beforeFilter to AppController and it should be good.

Geoff

On 8/25/07, rtanz <[EMAIL PROTECTED]> wrote:
>
>
> i have modified as you said( below) however a user can still access
> the index page of the admin area as before, so problem not solved yet.
> any other ideas?
>
> in routes:
> $Route->connect('/', array('controller' => 'users', 'action' =>
> 'login', 'home'));
>         $Route->connect('/admin', array('controller' => 'Pages', 'action'
> =>
> 'display', 'admin'));
>
> in users controller:
>
> function beforeFilter()
>     {
>         $this->checkSession();
>
>         if ($this->params["url"] == "admin") {
>                 $this->params[CAKE_ADMIN] = true;
>         }
>
>         if (!empty($this->params[CAKE_ADMIN])){
>                 //debug($this->params["url"]);
>                 $user = $this->Session->read('User');
>         $result = $this->User-
> >findByUsername($user['username']);
>                 if ($result['User']['user_level'] <> 'admin') {
>                         $this->Session->setFlash('Access Denied.');
>                         $this->redirect('/');
>                 }
>                         // set our layout based on admin routing vars
>                         $this->layout = "admin";
>                 }
>         }
>
>
> >
>


-- 
http://lemoncake.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to