Orkut has a privileged profile management, where user can manage what to allow and to whom. What should be the database design to achieve this result.
Elaborated :
Say I have given permission to view my -
1. DOB only to my friends.
2. My email only to me.
3. My college name to all.
etc.
-----------------------------------------------------------------------------------------------------------
If I use the following table for profile details I cannot manage the privilege.
user(id, username, password)
profile(id, user_id, dob, email, college, ... )
N.B. - user_id (FK from user)
id - PK
-------------------------------------------------------------------------------------------------------------
On the other hand,
user(id, username, password)
profile(user_id,detail_id,privilege_id)
privileges(id,name) [ 1-Me, 2-Friends, 3-Friends of friends, 4-All ]
details(id,name) [1-email, 2-dob, 3-college, 4-gender etc.]
N.B. - user_id (FK from user)
detail_id(FK from details)
privilege_id(FK from privileges)
id - PK
The second case solves the previous problem, but brings a weaker programming dependency on data entry for the details table. Also this method will bring problem to search data on a specific field.
Please anyone help me design a perfect database on this regard.