php - How to make a User Privacy Table in MYSQL -
i working on social networking website in have thought of creating groups, events , friend list. want user privacy friends given below :
1. user can select friends can view personal info or can't. 2. user can manage can see events , groups , can't.
i have designed table construction same pasting below :
user_location_id user_id allow_friends(ids separated comma) deny_friends(ids separated comma) allow_groups(ids separated comma) deny_groups(ids separated comma) allow_search (chapters of state,city) friends (visible some, hide some) ( if 0 geeting friends ids allow_friends else deny_friends) groups (visible some, hide some) ( if 0 geeting friends ids allow_groups else deny_groups) privacy_for_type privacy_for_nameshould there other construction efficient , can minimize database hits , don't create database intensive.
i'd recommend using 2 (or three) tables, separating users + groups, , permissions. users/groups table can contain info specific (and isolated) user/group (so #'s 1 , 2 user) , can add together field "type" or "category" says if user or group. if info you're storing users , groups different enough, can have separate tables each. permissions table can contain permissions, including #'s 4-9 on list (i don't know context of 10/11.) table can utilize manage grouping membership. next illustration of how construction permissions table:
permid: arbitrary unique primary key auto_increm column asset_cat: category (or table name) asset belongs asset_id: userid, groupid, etc. permission describes uid: user seeking permission permission: permission beingness sought asset_id uid value: value of permissionillustration entries:
//same listing 1338 in user 1337's allow_friends field 1002, 'user', '1337', '1338', 'allow_friends', 'true' //lists 1337 fellow member in grouping # 43 1003, 'group', '43', '1337', 'member', 'true'
these examples help started. allow me know if helpful, or if need me clarify :)
php mysql sql
No comments:
Post a Comment