I am building a web application in PHP. Users will access with their accounts. They will have resources like their pictures, notes, etc. in the system, as in Facebook.
My first problem is not letting anybody to access an account's private resource. Let say this is a picture. There are 3 situations:
- Everybody can access to that picture with URL of picture.
- A friend account of that picture's owner account can access that picture.
- Only owner account can see that picture, no body else. Even with URL of picture.
I don't know if Facebook does anything like point 1. Because business is important, and also privacy of users.
My first idea was making all resource accesses through a PHP file. But after a while it looked like really complex.
My another idea was keeping a list of all resources in a database table, and privacy setting together. This looks like a better idea, but I am not sure how performance will be affected in time.
What are your thoughts, how would you build a system like this?
P.S. I am planning to add one more web application, and create a shared resource area to put shared resource into. I will need same privilege system there as well.