Fix overzealous search and replace
Cache permissions
Add UDF definitions to instance adjuncts cache

This integrates the UDF cache with the instance "adjuncts" cache, which means that changes to UDF definitions will be recognized on all servers.

Fixes #1364
Invalidate cache when objects are deleted
When showing a user's own edits, don't worry about visibility

Showing a user's edits is complex because we check (for each instance, for each model) which fields the viewing user has permission to see. That results in an immense SQL statement.  But a user should be able to see all their own edits, so we can simplify that case (which is also the common case).

In addition we can simplify the giant query by excluding UDF bookkeeping fields once rather than once for each instance/model pair.