adding permissions and setup for maintaining flattened tree structure to Doc model