Friday, June 20, 2014

Re: I need logic to make private user groups


Thank you Stephen, 

I understand that I have to create an expanded, habtm relations between users and groups, but I have a brain freeze. 

So when the user is a member of a group, he see that group. When trying to access a group, the application first checks whether the user is a member of the group, if he is not a member, show him the error message, otherwise allow access. 

Thank you once again, pretty tired.

Nikola, 


Dana petak, 20. lipnja 2014. 19:08:55 UTC+2, korisnik Stephen S napisao je:
I would imagine something like the following if you wanted something very simple.

groups
id |  name | ...

users
id | ...

groups_users
id | group_id | user_id | admin | created | modified


The groups_users table would be a HasMany Through rather than HasAndBelongsToMany relationship so you can store admin as a tinyint(1), this way the original user who creates the group will have admin set to 1 and the other users invited would default to 0. You can create logic to specify admin rights in a very simple way, though there are more complicated (and possibly effective) ways to do this depending on what you need.

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasmany-through-the-join-model



On 20 June 2014 17:40, Salines <nikola....@gmail.com> wrote:
Okay friends, I need the following: 

enables registered members to dynamically generate user groups, where only members of the group can access content within that group. This is identical to do facebook group. 

So I need some logic, how to do it. thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.



--
Kind Regards
 Stephen Speakman

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: