Not sure if this is the problem but I am pretty sure the isAuthorized method
expects return true or false. Try adding else { return true; } at the end
so it always returns something. Like so...
if($this->action !="view")
{
if ($this->Auth->user('role') == 'admin')
{
return true;
}
$course_slug = $this->params['pass']['0'];
$teacher_courses =
$this->Session->read("User.courses");
foreach($teacher_courses as $temp_teacher_course)
{
if($temp_teacher_course['slug'] ==
$course_slug)
{
return true;
}
}
return false;
} else {
return true;
}
On Sun, Nov 15, 2009 at 5:54 AM, MaNuM <[email protected]> wrote:
> Hi Scott.
>
> Thank's for your answer. This is one of my isAuthorized methods:
>
> if($this->action !="view")
> {
>
>
> if ($this->Auth->user('role') == 'admin')
> {
> return true;
> }
>
>
> $course_slug = $this->params['pass']['0'];
> $teacher_courses =
> $this->Session->read("User.courses");
> foreach($teacher_courses as $temp_teacher_course)
> {
>
> if($temp_teacher_course['slug'] ==
> $course_slug)
> {
> return true;
> }
> }
>
> return false;
> }
>
> The thing is that when the user that is not logged in tries to access
> a function that is not "view", the browser shows the "The page is not
> redirecting properly" message...
>
> On 12 nov, 01:17, Scott Dahl <[email protected]> wrote:
> > Can you post your isAuthorized method? Also, you shouldn't need that
> method
> > in every controller just in app_controller.php...the rest will inherit it
> > automagically.
> >
> > On Wed, Nov 11, 2009 at 3:42 PM, MaNuM <[email protected]> wrote:
> > > Hi all.
> >
> > > I have a problem in my application when I try to access some pages
> > > (belonging to not allowed actions group) and user is not logged in,
> > > the browser shows this message.
> >
> > > The page is not redirecting properly
> >
> > > I have the isAuthorized method redefined in every controller.. I don't
> > > know the cause of this.. Could it be anything related to the cookies??
> >
> > > Thank's and regards.
> >
> > > --
> >
> > > 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]<cake-php%[email protected]>
> <cake-php%[email protected]<cake-php%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=.
>
> --
>
> 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]<cake-php%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=.
>
>
>
--
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=.