component output="false" extends="_handlers"{
//Pre Handler
public function preHandler(event,action,eventArguments){
var memberDenied = true;
if (memberDenied)
event.overrideEvent('_cpd.noaccess');
}
//Main
public function main(event,rc,prc){
//display main page
}
//No Access
public function noaccesss(event,rc,prc){
//display no access page
}
}
<cffunction name="preHandler">
<cfset event.overrideEvent('main.boo')>
</cffunction>
<cffunction name="index">
<cfset event.setView(view="main/index")>
</cffunction>
<cffunction name="boo">
<cfreturn "boo!">
</cffunction>
--------- Original Message ---------
Subject: [coldbox:22092] [coldbox 3.8.1] Override event or view in Handlers preHandler() method
From: "Jason Morris" <jason.mor...@gmail.com>
Date: 8/12/14 11:25 pm
To: col...@googlegroups.com
I want to run a preHandler AOP method on a handler which checks to see if user can access this handler, and if not, give them a message that they can't.My current handler is below.. from what I can tell working through the Coldbox Docs, this should do what I am trying to do, but when I access the 'main' action, it is showin the main view, but I would expect the preHandler to override this and show me the noaccess view (via the noaccess method).Can anyone see what I might be doing wrong?Thanks
componentoutput="false"extends="_handlers"{
//Pre Handler
publicfunctionpreHandler(event,action,eventArguments){
var memberDenied = true;
if (memberDenied)
event.overrideEvent('_cpd.noaccess');}
//Main
publicfunctionmain(event,rc,prc){
//display main page
}
//No Access
publicfunctionnoaccesss(event,rc,prc){
//display no access page
}
}
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.