Jump to:

3448 Posts in 1062 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Question regarding Member and Decorators

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

Page: 1
Go to End
Author Topic: 409 Views
  • JonC
    Avatar
    Community Member
    8 Posts

    Question regarding Member and Decorators Link to this post

    Hi, I'm not sure if this is the right place to ask this question (and if it isn't, I'm very sorry).

    I'm currently trying to create a site with a lot of members-based functionality - the site isn't accessible without a member login at all, and has (currently) two levels of functionality for different levels of membership. One of the things the site has to do is allow a member to transition between different types of member: the base case is that a normal user may upgrade themselves into a user with more privileges.

    The issue I'm having is that the upgraded users need to be sorted separately from the standard users, and that some things may only apply to each user category individually.

    From ssbits and the documentation on the main site, I gather it's possible to add decorators to Member itself in order to extend functionality to members: is it then possible to treat the decorated and un-decorated Members as separate classes (after applying the decorator with a form?), or would I have to create two separate classes extending Member?

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Question regarding Member and Decorators Link to this post

    The thing is that a decorator applies to the class so all members get decorated, not just a few.
    You might be better off using groups to signify different levels of privilege (which is what groups are for) and use a decorator to add custom fields and functionality to the member class if you need it.

  • JonC
    Avatar
    Community Member
    8 Posts

    Re: Question regarding Member and Decorators Link to this post

    Thanks for the information! So, I would have all the extra functionality simply check if a member is a member of a certain group, or else forbid the action, and have the second (or higher) levels of user, which require extra data compared to a normal member, be present as a Members decorator, simply not populated or used within the standard Member object?

    That is simpler than I thought. Is there documentation beyond the base API of how to work with user groups and user-based stuff like Members adding new instances of certain DataObjects with forms, and so on? I'm a newbie and not quite used to SS, forgive me if this is common knowledge.

    409 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.