douzen1896
douzen1896
2010-01-21 22:58

存储和访问WebApp用户隐私设置的最佳实践?

已采纳

If you allowed people to determine who could view their user information, what would be the best way in which to store and access that information?

They would be setting their preferences in any of these ways:

  • User Based (select specific users - ie. Block: "Munch", "Dummy")
  • Checkbox Based (select one or many groups of users - ie. "My Friends", "Anyone in my Network")
  • Radio Button Based (select only one group of users - ie. "Everyone")

My current thought is that, because the information is relevant to the user being viewed and not the one clicking around the site, you would have to store these options in a database, and based on the any particular combination of results, run a certain query.

The only issue is there could be a seemingly huge number of different queries:

  • 7 checkboxes could have up to 128 different combinations (2^7)
  • 128 combinations = 128 different optimized queries

This does not seem to be efficient in either time spent writing the queries or in the amounts of queries for every page view (querying to get another query to run...blech!).

And because I'm sure this has been done before, I feel like I must be overlooking something. Is there a better way to do this using PHP/MySQL?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • douliaopan1419 douliaopan1419 11年前

    I would precalculate results into a table of 'can not views', ie if usera in some form blocks userb (directly or because hes in a group), the table gets a record saying just that. its the age old one of doing the heavy lifting on writing rather than reading.

    点赞 评论 复制链接分享
  • douhang5493 douhang5493 11年前

    I think the best option would be the Radio Button based one. It would be quite painful going through a list of users you know all the time, too. The checkbox one doesn't sound so bad either.

    Well. Look at this example: You select "Everyone" in the Radio Button group - why would someone want to hide it from his friends then?

    Radio Buttons would be both the easiest way for the user and you.

    best regards, lamas

    点赞 评论 复制链接分享