I am writing an application to manage parties. I have some basic tables:
USERS : People who have registered to use the application
GROUPS: A user can belong to many groups. Examples include :{FAMILY, FRIENDS}
USERS_GROUPS: Which groups the user belongs to.
PARTIES: Different parties that have been created.
USERS_PARTIES: Join table (which users are coming to which parties)
I now want to implement the concept of a private party. Only users who are on a invitation list should be allowed to view and register for this private party. I’d like to be able to invite users to this party on a per user basis or/and on a group basis.
It seems like a bad solution to do the following:
1) Add a field to PARTIES called something like private. This will either be 1 or 0.
2) Create a new table called GROUP_INVITATIONS. This would be used to specify which groups are invited to the event.
3) Create a new table called USER_INVITATIONS. This would be used to specify which users are invited to the event.
Is the above a reasonable solution? Are there better ways to approach this issue? As a side note CakePHP has a concept of ACL (access control lists), but this only allows a user to be part of 1 group. This also seems like a separate issue from restricting access to certain actions of the MCP application. I do plan on using ACL to do this, but in this case Users will belong to one and only one role, which will determine which functions they have access to in the web application.
Well, I think your going in the right direction.
Definitely a boolean field (a flag)
privatefor the modelParty.I wouldn’t create a
groups_invitationstable. Rather, when a group is invited – create an invitation for every user belonging to that group. I think it’s just easier that way.As for the
users_invitationstable… maybe try to include that in theusers_partiestable(if you want to strictly follow Cake’s conventions – it should actually beparties_users). Something like:When a user is invited to a private party, you create a link (a record) between him and the party, it is up to him to change
comingto true. As for public parties – the user creates a link(a record) when declaring arrival (settingcomingto true). For adding (and deleting) HABTM records, see this great behavior.Well, taking a second to think about it – maybe including invitations in the join table isn’t the best idea – too complicated I guess. Looking forward to some comments on that, since I’m torn.