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

...ions for documents and categories
looks like it gets incremented at the (line 28)[https://github.com/wtg/flagship_docs_4/pull/4/files#diff-027ddb278b17a8097500c191f058501dR28], it looks like this is a great use case for `.each_with_index`