In my quest to bring the features of Livejournal (and other proprietary social networks) to the open, public internet, I'm stuck on how to properly implements friend groups. Friend groups determine which users are allowed to see your more sensitive blog entries. I've pulled together a description of several alternative models, and I'd like some input.
Let's say I create a group called "School" and write a post called "My Teachers", with that group allowed to see the post. A year later, I add a user to the group. Should the user have permission to see all previous posts in the "School" group? In other words, are permissions retroactive?
Conversely, if a user is removed from a group, do they lose permission to see posts in that group?
The following elements are invariant between models:
- Each post is associated with one or more groups. (Having multiple groups is optional.)
- Each user is in one or more groups.
- Each group contains zero or more users.
- When a post goes public, the users in the associated groups have permissions to see the post. This may change over time.
- Ad-hoc, unnamed groups can be created on the fly. (User selects a list of users who have permission to view a post, and that creates a group.)
Here are three variants that I can imagine:
- The most obvious model is fully dynamic and retroactive. Groups and users are in a many-to-many relationship, and a user can only see posts that are currently posted in that user's groups.
- Another approach is to associate user permissions directly with posts. (Users and posts in a many-to-many relationship.) When I write a post that is available to the "School" group, the members of that group are given explicit permission to see the post. Changes to a group's membership do not affect old groups.
- When a user is added to or removed from a group, the app asks if the change should be retroactive. This would require some funky hybrid of the static and dynamic models, perhaps using versioned groups for non-retroactive changes.
Which one of these makes the most sense to you? Feel free to propose alternate models as well.