Re: authenticate wont reroute
OK I have the answer. It isnt anything to do with htaccess or routing. This is a authenticate issue as I thought it would be. *property *AuthComponent::$unauthorizedRedirect Controls handling of unauthorized access. By default unauthorized user is redirected to the referrer URL or AuthComponent::$loginAction or ‘/’. If set to false a ForbiddenException exception is thrown instead of redirecting. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
The issue is that the router adding to the subfolder where the project resides in and not the root dir which I cant access with routing. I cant get to the desired page for unauthorized users. Router::connect('/', array('controller' => 'users', 'action' => 'login')); this routes to crm/crm/... again with the project name repeated and how do i stop this as this is the problem? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
I still cant get this to work, htaccess is not the answers for unauthroized users. If it is then could someone please show me the code. How does cakephp handle unauthroized access from the address bat? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
the user is not authenticated and if they try to access a webpage they shouldnt then surely I can code for this . The problem doesnt happen if authentiation isnt used so it must be able to be controlled with authentication otherwise how does ./htaccess have any idea of what user is accessing a webpage -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
Sounds like it's nothing to do with Auth but as Leandro suggested your directory structure and web settings / .htaccess. On 7 August 2014 15:18, ajt wrote: > //ajt > public $components = array( > > "Email", > 'Session', > 'Auth' => array( > 'loginRedirect' => array('controller' => 'users', 'action' => > 'dashboard'), > 'logoutRedirect' => array('controller' => 'users','action' => > 'login' ), > 'authorize' => array('Controller'), // Added this line > // array('DebugKit.Toolbar' => array( 'panels' => > array('MyCustom', 'timer'=>false))), > > )); > > > public function isAuthorized($user) { > // Admin can access every action > // debug($user['role']); >// debug("asdd"); > > if (isset($user['role']) && $user['role'] === 'admin') { > return true; > } >// return $this->Auth->redirectUrl(); > // Default deny > return false; > } > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
//ajt public $components = array( "Email", 'Session', 'Auth' => array( 'loginRedirect' => array('controller' => 'users', 'action' => 'dashboard'), 'logoutRedirect' => array('controller' => 'users','action' => 'login' ), 'authorize' => array('Controller'), // Added this line // array('DebugKit.Toolbar' => array( 'panels' => array('MyCustom', 'timer'=>false))), )); public function isAuthorized($user) { // Admin can access every action // debug($user['role']); // debug("asdd"); if (isset($user['role']) && $user['role'] === 'admin') { return true; } // return $this->Auth->redirectUrl(); // Default deny return false; } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
I had the same problem. It only works when I put the app in DocumentRoot, not in a subfolder. 2014-08-07 11:06 GMT-03:00 ajt : > This didnt work. > > If the user tries to type the url manually in the adress bar then > isauthorized doesnt route the unauthorized user anywhere but root dir and > how do i code for this? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
Please post your Auth component setup, isAuthorized isn't responsible for which URL to redirect to - it only returns true or false, you can place a redirect in there but it's better to fix the problem anyway. On 7 August 2014 15:06, ajt wrote: > This didnt work. > > If the user tries to type the url manually in the adress bar then > isauthorized doesnt route the unauthorized user anywhere but root dir and > how do i code for this? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
This didnt work. If the user tries to type the url manually in the adress bar then isauthorized doesnt route the unauthorized user anywhere but root dir and how do i code for this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: authenticate wont reroute
It looks like you're using isAuthorized wrong, assuming your /students/ path is a prefix, you would do something like this. if($this->params['prefix'] == 'students' && $user['role'] !== 'student') { return false; // Only students can access /students// etc } return true; // No checks failed, have at it. If you're students url is a controller not a prefix just change the condition to match, do this for each role. If there is a redirect problem it's likely to be with your Auth setup not isAuthorised as isAuthorised should only really return true or false. On 7 August 2014 13:58, ajt wrote: > Hi, > > I can authenticate a user but I get problems when a user tries to access > from the address bar a webpage it hasnt got access to. > What happens is that I get routed to the base index file with > missingControler error. > SO my path is /crm/students on a webpage the user should not access > and then i get directed to /crm/crm/ > > public function isAuthorized($user) { > > > if (isset($user['role']) && $user['role'] === 'manager') { > return true; > } >if (isset($user['role']) && $user['role'] === 'student') { > return true; > } > > if (isset($user['role']) && $user['role'] === 'teacher') { > return false; > } > > return parent::isAuthorized($user); > } > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.