Recursively hide tree sub categories at deeper levels and update permiss...

...ions for documents and categories
Okay, I'll give this a try. It does look much neater than my current solution