I'm having a hard time understanding how the CakePHP admin system works.
- Should all controllers who has an action which requires login include AuthComponent or just the one who handles the login/logout?
Let's say I want to protect the add action of a controller. First I createTurns out it was better to just controll this withadmin_add()
in the controller and then in thebeforeFilter()
method I check if$this->Session->check('Auth.User')
is set a redirect based on this?$this->Auth->allow()
What is the easiest way to return to the URL the user was trying to access? Is there a better way than setting a session variable?Turns out it does this automagically :)
If someone has a good tutorial for this I would happily read it :) I've already read this tutorial but I found it to be a little to basic and the CakePHP-docs are not that great on this topic either.
we have created an admin system for cakePHP, works similar to the scaffolding but it's configurable and ready to deploy, check it at http://browniephp.org
There is no Cake admin system as such. There is Authentication component and there is Access Control List component. You can use only Authentication component if you wish or you can use both of them. If you want to create your admin system from scratch follow this tutorial. Or you can try already created admin panel - PoundCake Control Panel.
You can learn a lot from others codes, specially something like CakePHP Admin plugin at: https://github.com/Maldicore/Admin