Facebook 如何处理数据库端的隐私设置?

发布于 2024-10-07 03:12:23 字数 403 浏览 2 评论 0 原文

像facebook这样的隐私系统的设计模式是什么?

用户根据他的朋友组决定分享哪些信息。所有用户信息(电子邮件、电话)都存储在数据表中,即键=值表。

当前表:

  • User - (id)
  • UserData - (id, user_id, datatype, value)
  • Friendship - (user_id,friend_id,friendgroup_id)
  • FriendGroup - (user_id, name)

示例:

  • X 组可以看到phone_1
  • Y 组可以看到phone_2
  • 所有组都可以请参阅phone_3

此架构可以更改。

What are the design patterns to design privacy system like facebook's.

User decides which information to share based his friend groups. All user information (email, phone) is stored in the data table which just key = value table.

Current Tables:

  • User - (id)
  • UserData - (id, user_id, datatype, value)
  • Friendship - (user_id, friend_id, friendgroup_id)
  • FriendGroup - (user_id, name)

Example:

  • X group can see phone_1
  • Y group can see phone_2
  • All groups can see phone_3

This schema can be changed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

聽兲甴掵 2024-10-14 03:12:23

您必须为 FriendGroup 制作权限表。
因为您必须收集授予每个 FriendGroup 的权限,同时使组或用户可以更改该权限。

Prmissions(permission_id,friend_group,parameter,visible)

示例:

  • X组可以看到phone_1
  • Y组可以看到phone_2
  • 所有组都可以看到phone_3

<前><代码>(1,x,phone_1,true)
(1,Y,phone_2,真)
(1,x,phone_3,真)
(1,Y,phone_3,真)

您可以通过以下链接了解有关 ACL 的更多信息:

包含用户、角色和权限的数据库模型权限

基于角色的访问控制(RBAC) PHP 系统

构建社交网络类型应用程序的模式?

You will have to make permissions table for FriendGroup.
In that you have to gather permission given to each FriendGroup while making group or user can change that permission.

Prmissions(permission_id, friend_group, parameter, visible)

Example:

  • X group can see phone_1
  • Y group can see phone_2
  • All groups can see phone_3
(1,x,phone_1,true)
(1,Y,phone_2,true)
(1,x,phone_3,true)
(1,Y,phone_3,true)

You can more see about ACL following links:

Database model with users, roles and rights

A Role-Based Access Control (RBAC) system for PHP

Patterns for building social network type applications?

梦里泪两行 2024-10-14 03:12:23

我创建了一个名为隐私设置的 gem,它可以帮助将简单的隐私设置集成到 Rails 应用程序中。查看:https://github.com/xuanchien/privacy_setting

I have created a gem called Privacy setting that can help to integrate simple privacy setting to Rails application. Check it out: https://github.com/xuanchien/privacy_setting

青朷 2024-10-14 03:12:23

您需要一个基于角色的权限管理系统。查看 CanCan声明性授权 gems。

You want a role-based rights management system. Take a look at the CanCan or DeclarativeAuthorization gems.

猥︴琐丶欲为 2024-10-14 03:12:23

您可以添加列名称权限,其中包含所有字段,如

电话号码和电话号码权限、照片和照片权限,并在权限列中使用值 0、1、2、3,

permission rights
0. Not show to anyone
1. Show to friends
2. Show friends of friends
3. Show to groups and who are your friends

您必须在个人资料页面上的查看数据上管理此权限。

如果用户 == 朋友且权限 == 1 显示数据

you can add a column name permission with all fields like

phone_number and phone_number_permission, photo and photo_permission and use value 0,1,2,3 in permission column

permission rights
0. Not show to anyone
1. Show to friends
2. Show friends of friends
3. Show to groups and who are your friends

you have to manage this permission on view data on profile page.

if user == friend and permission == 1 show data

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文