CakePHP access denied

718 Views Asked by At

In CakePHP I have this configuration:

//Config/routes.php
Router::connect('/viewServices', array('plugin' => 'usermgmt', 'controller' => 'services', 'action' => 'viewServices'));

//View/Users/dashboard.ctp
<?php echo $this->Html->link(__("Services",true),"/viewServices")?>

//View/Services/view_services.ctp
//I put here the view..

//Controller/ServicesController.php
public function viewServices(){
....
}

Now I can't understand the reason why it doesn't works!

I can't see the "view_services.ctp". The server redirects me to the "access_denied.ctp" page, but in the "view_services.ctp" I didn't put any control about the authentication, so maybe I'm doing other errors. Can somebody helps me?

Thanks!

1

There are 1 best solutions below

0
On

I solved the problem changing it:

//Controller/Component/UserAuthComponent.php
.....
//CHANGE IT:
//if(!$userGroupModel->isUserGroupAccess($controller, $action, $this->getGroupId()))
//WITH IT:
if(!$userGroupModel->isUserGroupAccess($controller, $action, 1))

In this way, it works!

Thanks to everybody!