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.