Use r.is to check for fully routed path only once instead of twice.
Hoist authorization and firewall rule retrieval and checking to
the r.is block.
Move non-database code out of the DB.transaction block.
This calls check_found_object multiple times in a route, which
raises a duplicate authorization check exception. Modify
check_found_object so it will not raise a duplicate authorization
check exception.