In my onRequestStart or in an Interceptor how could I check if the
current request is in a particular package or not? Is there a slick
way of handling this, or would I just do some string manipulation on
"getCurrentEvent()"?
if not, this may be a useful method to add to the coldbox tool kit?
maybe, perhaps, whatever...
Salomoko, were you considering also that it may be that an app could have nested packages as well? So if you wanted to know if it was in the ‘security’ package, does that mean then that ‘security’ could be a nested package, and we should check packages recursively and return true if it exists at all? Just wondering if you were envisioning that scenario.
Seems to me that since the current event is essentially the handler path to a targeted method, parsing the event string is the unavoidable way of validating the targeted package, right? Even the framework itself has to parse the event string to figure out how to navigate to the correct handler cfc and method. Myself, I think I would create a global UDF (custom plugin, perhaps?) to parse the event string to answer the question you pose below, treating the event string as a list (delimited with a period for non-ses, or slash for ses) and perform a listfind. As long as the package name I’m looking for isn’t the last item in “the list” (which would be the targeted method), I’ll know it’s the package I’m looking for.