5
votes

I have a few questions about CakePHPs ACL and Auth system.

  1. Whats the naming convention of the aliases in the acos table? Is it 'controllers/Posts/add' or just 'add' with the parent id from 'Posts'?
  2. My login doesn't work. When I try to login I don't get any error message but the Auth.User and the Auth->user('id') are both empty. What could be the problem? I do everything like in the ACL example from CakePHP.

Thank you.

UPDATE: My login works now (Problem with the time settings on the server) and my acos table looks right but I can't go to any action. I allowed the action in the aros_acos table. If I check the permission with '$this->Acl->check()' it just works if I give the single name of the action and not the full path ('controllers/Posts/add' doesn't work).

2
The naming convention for the alias in the ACOS table is the second option that you gave: add with the Parent ID of posts. We would need to see your code for the login problems. - Bill Rollins
The login problems are solved. But I still have problems with ACL. - FrediWeber
From personal experience I totally prefer ACL not in the DB. I've noticed it causes a ton of problems like different access on different dev boxes and on production. I suppose that can be solved with migrations. Cake does have a file based ACL. I was going to look into using that. Just random info for you. - Parris

2 Answers

1
votes

I solved the problems by:

  1. Make sure the time on the server is correct. Otherwise sessions won't work.
  2. Correct the table data in the acos table. Especially make sure that the 'lft' and 'rght' values are correct. This page may helps: http://www.sitepoint.com/hierarchical-data-database-2/
  3. You need to add every action you want to use to the acos table. If you don't do this you're not allowed to do this action. Even if you allow the hole controller.
0
votes

To fill the ACO datatable easily, you could also use my plugin: http://www.alaxos.net/blaxos/pages/view/plugin_acl_2.0

Then no need to bother how the records have to be created, it would do it for you ;-)