Reputation: 9803
Basically i've a table for my users (it's nightclub website) and now i'm trying to improve they privacy.
Until now i just show some information to logged in users, but now i want to give that choose to users.
My question is: What would be the better approach to do it?
What do you recommend me, create a new property for each property that i want users to manage the privacy?
Example of table "Users":
-Id
-Phone
-ShowEmail (int) and 0 would be to no-one, 1 to logged in users and 2 to friends
-ShowPhone (int)
It's a good choose? I'm not quite sure if i should create a new table to handle the privacy settings. I must admit that database design isn't my specialty so really need some feedback about this.
Thanks!
Edit: the privacy isn't just about simple properties. I would need to handle the events that the user signed up, photos where user is tagged, etc.
Upvotes: 4
Views: 769
Reputation: 14060
That is a possibility, but it makes your table very large and with kinda redundant fields. You have two options which I personally like better:
Queries would look something like this: 1.
SELECT phone, (privacyFlags&8) AS showPhone FROM users
2.
SELECT user.phone, privacy.ShowTo AS showPhone FROM users
JOIN privacy ON privacy.userID=users.userID
WHERE privacy.FieldName = 'phone'
Upvotes: 2