Added a functionality in document_detail so that it sends permissions as well