Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Member/Group relationship


Reply

3 Posts   567 Views

Avatar
jayslippy

7 January 2012 at 12:53am Community Member, 10 Posts

Brief Question: Is it possible (or advisable) to change the relationship between Member and Group to one-to-many from many-to-many?

Detail: I'm building my first website, and using silverstripe to do it. The site will have a large number (hopefully!) of members, who will be split into two categories, client and supplier. The two sets will be completely distinct (except for a couple of special case admins), and see different sides of the website. For example different user profiles, different pages, different tools. Ideally there would be a field in the Member object (added via a decorator) indicating which of these groups the member belongs to.

I know this is mostly possible with the many-to-many relationship, just by querying whether the member has the relationship with the first group and if not assuming the relationship is with the other group. But it doesn't seem very elegant. There is a possibility of a user being added to both or neither group for example.

Any advice would be appreciated.

Thanks.

Avatar
swaiba

7 January 2012 at 1:00am Forum Moderator, 1796 Posts

Hi jayslippy,

Welcome to the Forums!

My advice would be - do not mess with anything in the core - especially something within the security section!
I've got thousands of members on a site and use a decorator for any custom functionality is fine to show one thing to some and and something else to others.

Avatar
jayslippy

7 January 2012 at 8:12am Community Member, 10 Posts

That's a good point, I'll take your advice. Thanks for the quick response.