Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFR] ACL - beforeDispatch too early, beforeExecuteRoute too late #703

Closed
hesalx opened this issue Jun 17, 2013 · 3 comments
Closed

[NFR] ACL - beforeDispatch too early, beforeExecuteRoute too late #703

hesalx opened this issue Jun 17, 2013 · 3 comments

Comments

@hesalx
Copy link

hesalx commented Jun 17, 2013

I really can't find reliable place for ACL checks.

If I place it in beforeDispatch() then I don't know existence of controller/action and can't send the adequate response. If 404 is sent the user could think that the actually existing page doesn't exist. If 403 is sent that user can think that actually nonexisting page exists.
It should send 403 and 'you have to keep more access rights' for existing page and 404 'page you want doesn't exist' for nonexisting page.

If I place acl in beforeExecuteRoute() then initialize() is executed before acl check and cause many problems. I perceive initialize() like a part of the action which executes right before. There are many cases when you want do some thing for any action in the concrete controller (because, for example, it is used in the controller layout for all the actions) and this thing requires respective access (for example read a data for the user). But you can't do this safety because initialize() is called before acl check. And there could happend accident when app tries to get user's data when session isn't logged-in and there is no user actually...

I'm proposing to make some event executes when app knows existence of the controller and the action, but executes before any-any business logic.

@iforp
Copy link
Contributor

iforp commented Jun 24, 2013

@phalcon
Copy link
Collaborator

phalcon commented Jun 25, 2013

I moved the initialization after 'beforeExecuteRoute' is executed in 1.2

@hesalx
Copy link
Author

hesalx commented Jun 25, 2013

Thanks!
Oh! Perfect! At last this will works as I want ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants