Hi,
I work on the cookbook blog tutorial. A piece of code give me a bug.  When I 
try to access to www.example.com/posts/add , I am forward to the home page. 
But, when I comment the line (orange highlighted), I can access to the 
/posts/add page.
I think it could be related with the 
authcomponent<http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent>
.

Code (source: 
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html,
 
section: "Authorization (who’s allowed to access what)")

public $components = array(
    'Session',
    'Auth' => array(
        'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'pages', 'action' => 
'display', 'home'),        'authorize' => array('Controller') // Added this line
    ));
public function isAuthorized($user) {
    if (isset($user['role']) && $user['role'] === 'admin') {
        return true; //Admin can access every action
    }
    return false; // The rest don't}


*
*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to