-2

I am implementing a simple database system. Basically is a simple social network, everyone has his own dashboard, where you can post some random text. The problem is that I want a privacy level, I mean I want that somebody is allowed to browse only some profiles. And I'm deciding who can watch what.

The question is: How can I do that?I have to work with relation in the database or what?

Thanks for your time.

S.

Wes Crow
  • 2,971
  • 20
  • 24

3 Answers3

2

What you are looking for is called "Access Control List" (ACL): Check out Nettuts tutorial on implementing an ACL: http://net.tutsplus.com/tutorials/php/a-better-login-system/

Wes Crow
  • 2,971
  • 20
  • 24
0

Create a secondary table where you keep who can access what. If in the main user table you have and id or something (preferably indexed) (like you should). Just make a 2 column table with id and view_id or something (both foreign keys and togeder should form a pk). And... you read from it.

zozo
  • 8,230
  • 19
  • 79
  • 134
  • Ok. ACL is better. He asked for a simple way. Now... what is wrong with what I suggested? Don't care about downvote but I care why is wrong? – zozo Feb 10 '12 at 14:08
  • Yah what he is trying to ask is the the simple way. – tomexsans Feb 10 '12 at 15:10
0

Most probably you would want to set a table for your privacy like

id                 type
1            View All
2            View None
3            View Something

then on your table where users can be found you could call the type

user_id    privacy_id 
1            2
2            3
4            1

where privacy_id is the id of your privacy table, something like that.

tomexsans
  • 4,454
  • 4
  • 33
  • 49