Admin section in CakePHP

2019-08-26 07:34发布

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 create admin_add() in the controller and then in the beforeFilter() method I check if $this->Session->check('Auth.User') is set a redirect based on this? Turns out it was better to just controll this with $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.

3条回答
2楼-- · 2019-08-26 08:10

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

查看更多
ら.Afraid
3楼-- · 2019-08-26 08:12

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.

查看更多
\"骚年 ilove
4楼-- · 2019-08-26 08:27

You can learn a lot from others codes, specially something like CakePHP Admin plugin at: https://github.com/Maldicore/Admin

查看更多
登录 后发表回答