This template can be called from a space. (No error handling when called from a document details page.) It traverses the space structure from the current space to all leaves. For each space, the inbound rules are displayed.
Full version (too much noise, but you will see what's happening)