douzen1896 2010-01-21 22:58
浏览 79
已采纳

存储和访问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 2010-01-21 23:36
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启