Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Login / Member option

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 3217 Views
  • Blackdog
    Avatar
    Community Member
    156 Posts

    Login / Member option Link to this post

    Hi,

    I want to add a member state (active, inactive, banned) which gets checked on login. The value is only set by the admin in the cms and is never visible to public. I have got this bit happening no worries.

    So if the member tries to login it checks the account to see which state it is in and acts appropriately.

    Where should i start to look for this?

    thanks.

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Login / Member option Link to this post

    anyone?

  • zyko
    Avatar
    Community Member
    66 Posts

    Re: Login / Member option Link to this post

    I would implement a DataObjectDecorator.
    Then add it as a role to Member
    http://doc.silverstripe.com/doku.php?id=dataobjectdecorator&s=decorator
    then implement
    updateCMSFields
    so that this 'member state' is only shown if a 'administor' is logged in...

    g
    Helmut

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Login / Member option Link to this post

    thanks Helmut,

    I have already decorated the member to include the member state.

    I now need to workout how to extend the authenticator classes to get it to check the member state.

  • zyko
    Avatar
    Community Member
    66 Posts

    Re: Login / Member option Link to this post

    i'm not sure why there's a need for a special authenticator?
    DataObjectDecorator can define default for field-values
    fe: 'active' for your 'member state'.
    then someone could fe. 'special implement'
    SiteTree::canEdit() for pages,
    if these Memers are canCMS Members.
    Additionally you could generate getCMSFields on your classes, depending on member state...

    And only for restrictions about frontend users (members)
    i could do things specially while frontend rendering, depending on your member state.
    what is the missing part, so where's the need for an authenticator?

    g
    helmut

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Login / Member option Link to this post

    Because, won't that still log them in and just block them from seeing certain content?

    I want them to be blocked from logging in but not have to remove them as members.

  • zyko
    Avatar
    Community Member
    66 Posts

    Re: Login / Member option Link to this post

    ok,
    i thought about
    'why not let him log in, if then, there's nothing he can do?'

    which means i'ld throw
    Security::permissionFailure(null);
    in any controller, if he's not 'active'.

    so it wouldn't matter that he is logged in...
    i could additionally show him 'you're blocked' in his member profile...

    g
    helmut

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Login / Member option Link to this post

    Actually that is a good idea Helmut, that would make customising the message that they get much easier.

    It would also allow them to take the right steps to have the ban removed but delivering custom messages through to them in their profile page.

    3217 Views
Page: 1 2
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.