0

I'm using Loopback, and I'm trying to figure out how I can tell in an Operational Hook if the model is being accessed as a result of a query to the original end point or through a relationship.

I have some custom filtering I am doing that is unrelated to the ACL, and it works well when querying a specific endpoint. However, it has been causing some issues when querying an endpoint, and then including related models. Thus, I'd like to be able to detect when the model is being accessed via a relationship, and disable the filtering for these instances.

Any suggestions on how to go about doing this?

Thanks in advance!

Jonathan
  • 680
  • 1
  • 9
  • 24
  • I think I figured this out. What I've been looking for were the "Remote Hooks", not the "Operational Hooks". Evidently remote hooks are only called when accessed via an external method, and not via internal references. – Jonathan Jun 02 '16 at 02:02
  • This issue is the same thing: http://stackoverflow.com/questions/29373201/adding-a-filter-inside-a-beforeremote-remote-hook – Jonathan Jun 02 '16 at 13:11

0 Answers0