My question is similar to this one except that I need the files for a group of records, making the solution of querying ContentDocumentLink unworkable, because it requires a single Id for the where clause.
Currently I am querying the Object__Feed for all content posts, but now that files can be posted as comments this solution is incomplete. I also need to get the files that were posted as comments.
Is there any way to do this? I've tried querying the ContentVersion directly using the relatedRecordId on the chatter comment, but there is a security restriction that the file is not returned if it is privately shared, even though it's visible on the chatter feed of the record.
Edit The exact use case is for a controller displaying all the chatter files for a list of objects. The controller is a without sharing class, and when run as a system administrator the ContentVersion records are returned and displayed on the page. When run as anyone other than a System Admin the same page returns no records. Why isn't without sharing working?