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
`
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
}
}
`