is really not explaining what each setting used in the code means, nor
it has a link to the API documentation.
Even the API documentation is completely confusing for the beginner.
Check this out from http://api.cakephp.org/class/auth-component:
"authorize mixed
The name of the component to use for Authorization or set this to
'controller' will validate against Controller::isAuthorized()
'actions' will validate Controller::action against an
AclComponent::check() 'crud' will validate mapActions against an
AclComponent::check() array('model'=> 'name'); will validate
mapActions against model $name::isAuthorized(user, controller,
mapAction) 'object' will validate Controller::action against
object::isAuthorized(user, controller, action)"
Man, me as a beginner can't understand a word what's written there.
And I am pretty sure that I might not be the only one. The cookbook
must write those in a comprehensible form, so that we can make sense
of the API documentation.
Also 5.2 http://book.cakephp.org/view/1250/Authentication, doesn't
explain what the AuthComponent is doing under the hood. It seems
magical to me.
All this seems frustrating. This is what I tried (see comments in
login() function).Basically I don't think the session is being saved
(I am assuming that AuthComponent is doing that internally for me):
class MembersController extends AppController {
var $name = 'Members';
var $components = array('Auth' => array(
'authorize' => 'actions',
'actionPath' => 'controllers/',
'userModel' => 'member', //Database table and model to use
'loginAction' => array(
'controller' => 'members', //CTP file's controller name
'action' => 'login' //Redirect to login.ctp file
),
'logoutRedirect' => array('controller' => 'members', 'action' =>
'logout')
),
'Session'
);
function beforeFilter() {
$this->Auth->allow(array('index','add','delete','login'));
}
function login() {
if ($this->Session->read('Auth.User')) { //Doesn't seem to pass this
if statement
$this->Session->setFlash('You are logged in!');
$this->redirect('/members', null, false);
}
}
function logout() {
$this->redirect($this->Auth->logout());
}
...
...
}
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment