create a method in ur component something like this
 function checkActionRight($action)
     {

$rightCategoryId=$this->Session->read($action.'.right_category_id');
         $optionId=$this->Session->read($action.'.option_id');
         if((int)$rightCategoryId>0 && (int)$optionId>0)
         {
             return true;
         }
         else
         {
               $this->controller->flash('Sorry! You don\'t have the rights
to access this page.',
'/'.$this->Session->read('RightHeader.selected_controller').'/'.$this->Session->read('RightHeader.selected_action').'/'.$this->Session->read('RightsHeader.selected_category_id').'/'.$this->Session->read('RightsHeader.selected_option_id'),3);
               return false;
         }
     }

On Wed, Jun 3, 2009 at 4:49 PM, Martin Westin <[email protected]>wrote:

>
> Do you output auth messages in your layout?
> They have their own "name":
> $session->flash('auth');
>
> I have done something like this in my layout a few times:
> if (is_array($messages = $session->read('Message'))) {
>        foreach (array_keys($messages) as $key) {
>                $session->flash($key);
>        }
> }
>
> It will output any and all messages in the session.
>
>
> On Jun 3, 10:32 am, Xanax <[email protected]> wrote:
> > Hi everyone,
> >
> > My problem is quite simple : i've setup auth and ACL in my application
> > everything seems to work fine unless one thing :
> >
> > When a user try to launch a forbidden (for him) controllers/actions,
> > it' just redirect him to another page autorized for him. I would just
> > like to have an explicit message error like "You don't have access to
> > this page. Please click here for being redirected..."
> >
> > Here are my Auth parameters for information :
> >
> >       $this->Auth->actionPath = 'controleurs/';
> >       $this->Auth->userModel = 'User';
> >       $this->Auth->fields = array('username' => 'login', 'password' =>
> > 'password');
> >       $this->Auth->loginAction = '/users/login';
> >       $this->Auth->loginRedirect = '/users/index';
> >       $this->Auth->loginError = "Identifiant ou mot de passe
> > incorrects.";
> >       $this->Auth->logoutRedirect = '/planifications/index_users';
> >       $this->Auth->authError = "Vous n'avez pas accès à cette page.";
> >       $this->Auth->autoRedirect = true;
> >       $this->Auth->authorize = 'actions';
> >
> > As you can see i've setup properly the "$this->Auth->authError"
> > property.
> >
> > Thank you very much for any help, have a good day!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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