Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP ACL and Auth not working

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).

like image 591
FrediWeber Avatar asked Nov 12 '22 22:11

FrediWeber


1 Answers

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.
like image 186
FrediWeber Avatar answered Nov 15 '22 10:11

FrediWeber