--------- Original Message ---------
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/8fa87944-93d7-4860-b18e-6119e0ab7019%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you’re not seeing the method executing, it may be because overrideEvent() will only work if used within preHandler or around the handler. If it’s called within the handler action, the rest of the action will still execute and you’ll see the output of that method.
When I need to override an event from within a handler action, I use a function that sets the headers, flushes and aborts the request, like so:
function onAuthorizationFailure(event=getRequestContext(),rc=getRequestCollection(),prc=getRequestCollection(private=true)){
log.warn( "Authorization Failure", getHTTPRequestData() );
header statusCode=STATUS.NOT_AUTHORIZED statusText="Not Authorized";
writeOutput(serializeJSON({'message':'Your permissions do not allow this operation'}));
flush;
abort;
}
In one of our module's handers I am trying to run an overrrideEvent when access is denied to something. I am using event.overrideEvent("security.noAccessToFile"). I thought it would recognize a main handler function from a module but it seems like I am missing something. Any thoughts?