i have setup a preDispatch plugin for my ACL. i have used the controller as resource, action as privilege. when i try to goto a non existent page, i get to the access denied page instead of 404, i think because the resource and privilege are queried and since they are not found, it goes to the access denied page...
how can i fix this? maybe my method of implementing the plugin was wrong? can i somehow have the check for a existent resource b4 my acl plugin runs? \
plugin code @pastebin
I had the same issue and added this to the preDispatch
function (using modules though, but it's the $acl->has()
function that is interesting):
if (!$acl->has($request->module . '_' . $request->controller)) {
// action/resource does not exist in ACL
$request->setModuleName('default');
$request->setControllerName('error');
$request->setActionName('notfound');
} else {
// resource does exist, check ACL
if (!$acl->isAllowed($role, $module . '_' . $controller, $action)) {
$request->setControllerName('user');
$request->setActionName('login');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With