/**
  * lists the documents the user has access to (including shared files, once the code in core has been fixed)
  * also adds session and member info for these files
  */
 public static function listAll()
 {
     self::preDispatch();
     $documents = Storage::getDocuments();
     $fileIds = array();
     //$previewAvailable = \OCP\Preview::show($file);
     foreach ($documents as $key => $document) {
         //\OCP\Preview::show($document['path']);
         $documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
         $fileIds[] = $document['fileid'];
     }
     usort($documents, function ($a, $b) {
         return @$b['mtime'] - @$a['mtime'];
     });
     $session = new Db_Session();
     $sessions = $session->getCollectionBy('file_id', $fileIds);
     $members = array();
     $member = new Db_Member();
     foreach ($sessions as $session) {
         $members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
     }
     \OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
 }