Tell which template called cfinclude
Is it possible to tell what template did a cfinclude?
What I'm looking at is a client asked to put security on his site (after the fact). The person who built it used a low end switch box type framework.
Ie cfswitch to determine what templates to include.
Now the problem comes in that you can navigate to any of those pages that are cfincluded bypassing the whole framework. The security was a very basic check of the access rights at the switch level.
So something like this:
<cfswitch expression="#TRIM(session.clearance)#">
<cfcase value="S">
<cfinclude template="supervisorHome.cfm">
</cfcase>
<cfcase value="A">
<cfinclude template="adminHome.cfm">
</cfcase>
.
.
.
</cfswitch>
But I can go to adminHome.cfm directly and no problem. Client says I can not change the way it is built but I need to make it so the visitor is forced to go through the framework. My guess is to go in the onRequestStart in the Application.cfc and see if the page request is NOT index.cfm, then make it so. But of course this means all the cfincluded pages will also go to the index.cfm page. I tried throwing in a flag saying to only go to the index.cfm page if the flag was not set. The flag being set on the initial request to true and then when the index template finishes loading it gets set to false.
Not working. So now I'm thinking if I can see the top most request page then I can do logic against that.
