开发者

Party Management Application. How To Private Parties?

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 开发者_Python百科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) private for the model Party.

I wouldn't create a groups_invitations table. 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_invitations table... maybe try to include that in the users_parties table(if you want to strictly follow Cake's conventions - it should actually be parties_users). Something like:

id
party_id
user_id
coming (boolean)

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 coming to true. As for public parties - the user creates a link(a record) when declaring arrival (setting coming to 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜