Improve the performance of directory listing.

Performance is improved by no loger executing a query for each file and
folder. Now a single query is executed for gathering all of a user's
permitted ids.

The folder_qs and file_qs QuerySets filter on the user's permitted ids
=> just 3 queries required (instead of one for each file/folder)

When having a root containing more than 300 folders, executing one query for each folder was so slow that the request would eventually time out (it took more than 1 minute to complete !!)

This is the same pull request as #308 , this time based on the develop branch.


<!---
@huboard:{"order":327.0}
-->