php - Symfony2: Custom "Entity Validation Checker" controller function for all routes -


premise: users on system need have accepted nda , sla , filled in questionnaire.

conditions:
1) entire system (from /) falls under security firewall in order determine whether user logged in or not.
2) routes under ^/ authenticated anonymously.
3) routes under ^/portal/ required role_user.

implementation: implement custom checker on routes under ^/portal/ (including /portal/, /portal/orders/, /portal/admin/, /portal/admin/orders/, etc) check whether user has accepted nda, , if not not redirect page user can accept nda, check sla , questionnaire.

question: there way implement in symfony2 "check" function gets called first , continues on actual controller function route set up, other manually calling check function in every controller function every route?

complication: nda/sla/questionnaire pages user redirected, need fall under ^/portal/, these must excluded check (either inside check function or in other manner) in order avoid continuous redirect.

to date, found no "generic" framework-level implementation this. solution implement create "checker/redirector" controller function , call in beginning of each controller function pages wished redirect should checks fail.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -