开发者

How to allow to users to access control their different profile elements?

开发者 https://www.devze.com 2023-01-03 15:52 出处:网络
Table users User_id, username, display_nam开发者_JS百科e, date_of_birth, email, telephone, website

Table users

User_id, username, display_nam开发者_JS百科e, date_of_birth, email, telephone, website

On some social networking sites, I can control who can view my email, date_of_birth or display_name, for example, friends can view my email but not guests etc. If I have to offer something similar on my website where users can contol email, telephone, display name (or other fields) and allow it to all, or to members only, then what sort of data table structure I need to store this information.

I was thinking to add fields like .. email_public_access (0,1), email_members_access(0,1) for each column I need control over!!

Any other ideas?


You could look at the database schema for Facebook [1] to get your inspiration on how complex the database structure will eventually be.

I don't think you need multiple columns to store the email access type, a single integer column would suffice. You need to use an enumaration with the possible values for the access type, like:

EMAIL_PUBLIC_ACCESS = 1
EMAIL_MEMBER_ACCESS = 2
EMAIL_FRIEND_ACCESS = 3
EMAIL_NO_ACCESS = 4

Another interesting article that's worth reading.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号