CakePHP authentication problem, allowedActions is not working
class CommentsController extends AppController {
function beforeFilter() {
parent::beforeFilter();
开发者_运维技巧 $this->Auth->allowedActions = array('add','edit');
}
But if i do http://mysite.com/comments/view/13 i got error =>
Error: The action view is not defined in controller CommentsController
Error: Create CommentsController::view() in file: app/controllers/comments_controller.php.
<?php
class CommentsController extends AppController {
var $name = 'Comments';
function view() {
}
}
?>
Notice: If you want to customize this error message, create app/views/errors/missing_action.ctp
And for http://mysite.com/comments/edit/13 =>
I got the edit page with that comment. That should not come. I should be prompted to login before editing any post.
Why isn't working ?
I got the edit page with that comment. That should not come. I should be prompted to login before editing any post.
remove the line $this->Auth->allowedActions = array('add','edit');
精彩评论