Rails 3, Paper_Clip + S3 - HowTo Save Files for an Instance and Protect Access

I have a Rail3 app with paper_clip, with the intent to store data on S3.

In the app, Users belong to an instance.

I would like the data stored across all the models per instance. Example /instance_id/photo/photo_id/files....

Then, I would like to prevent a user for Instance A from accessing, or being able to access files from Instance B. Also, for users not logged in, they shouldn't be able to access files.

What's the best way to handle this? thanks