mysql - CakePHP Acl controlled application failed ARO/ACO lookup - Permissions not registering -
i building profile based application. attempting use simple acl controlled application tutorial found here: http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html, create groups , permissions. have run problems getting permissions function when logged in different users. have admin, manager, , user group. have set acos , aros added permissions each group. here
class appcontroller extends controller { public $components = array( 'acl', 'auth'=>array( 'loginredirect'=>array('controller'=>'users', 'action'=>'index'), 'logoutredirect'=>array('controller'=>'users', 'action'=>'index'), 'autherror'=>'you cannot access page', 'authorize'=>array('actionpath' => 'controllers') ), 'session' ); public function isauthorized($user) { return true; } public function beforefilter() { $this->auth->authorize = array( 'actions' => array( 'usermodel' => 'user', 'actionpath' => 'users' ) ); $this->auth->allow('display'); $this->set('logged_in', $this->auth->loggedin()); $this->set('current_user', $this->auth->user()); } }
usercontroller.php
class userscontroller extends appcontroller { public function beforefilter() { parent::beforefilter(); $this->auth->allow('view'); } public function login() { if ($this->request->is('post')) { if ($this->auth->login()) { $this->redirect($this->auth->redirect()); } else { $this->session->setflash('your username/password combination incorrect'); } } } public function logout() { $this->redirect($this->auth->logout()); }
the error getting right is:
warning (512): dbacl::check() - failed aro/aco node lookup in permissions check. node references: aro: array permission::check() - core/cake/model/permission.php, line 94 dbacl::check() - core/cake/controller/component/acl/dbacl.php, line 73 aclcomponent::check() - core/cake/controller/component/aclcomponent.php, line 109 actionsauthorize::authorize() - core/cake/controller/component/auth/actionsauthorize.php, line 40 authcomponent::isauthorized() - core/cake/controller/component/authcomponent.php, line 412 authcomponent::startup() - core/cake/controller/component/authcomponent.php, line 336 objectcollection::trigger() - core/cake/utility/objectcollection.php, line 132 call_user_func - [internal], line ?? cakeeventmanager::dispatch() - core/cake/event/cakeeventmanager.php, line 248 controller::startupprocess() - core/cake/controller/controller.php, line 671 dispatcher::_invoke() - core/cake/routing/dispatcher.php, line 184 dispatcher::dispatch() - core/cake/routing/dispatcher.php, line 162 [main] - app/webroot/index.php, line 109
for reason can't access permissions. , can't seem find solution fix this. great! in advance!
those error because add function/method in controller did not re-populate acos , aros_acos table.
you need populate acos table
./console/cake aclextras.aclextras aco_sync
once populated, need assign permission of new method our aros_acos table
$this->acl->allow($group, 'controllers/posts/mynewcustommethod');
then run initdb function again. tutorial clear step step.
Comments
Post a Comment