Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Authentication / User Management in Silverstripe

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

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

Page: 1
Go to End
Author Topic: 4093 Views
  • julian
    Avatar
    Community Member
    17 Posts

    Authentication / User Management in Silverstripe Link to this post

    Hi guys,

    Silverstripe has definitely come at the right time for my project -- very exciting how quick it is to develop stuff. The tutorials (1-4) have been of high quality and extremely useful to bootstrap quickly.

    However I'm a bit lost when it comes to authentication. My site will require authenticated access and I'm not really sure where first base is on this -- does Silverstripe support authenticated access? I'm assuming so because of the security bits but over that... any clues? Pointers to source at this stage is fine. Things I'm wanting to do:

    - add a 'sign up' button taking them to a registration form with email verification
    - add a 'login' button which shows a form for a user to log in
    - add that login page as an interstitial if someone tries to access premium content -- i.e. they can click on the link but are redirected temporarily to the login page, after successful sign in of which it sends them to the page they wanted to go to.

    ?

    thanks!
    Julian
    Newly signed up Silverstripe advocate.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Authentication / User Management in Silverstripe Link to this post

    There are tools to help with this, but not something that works out of the box.

    I'll get the team to put together a mini-tutorial about this.

  • pouderStream
    Avatar
    Community Member
    33 Posts

    Re: Authentication / User Management in Silverstripe Link to this post

    That would be great Sam!

  • Hani
    Avatar
    12 Posts

    Re: Authentication / User Management in Silverstripe Link to this post

    Hi all,

    I stumbled upon SilverStripe today and I think its a great CMS system. However, I'm really hoping to be able to have the ability for User Management - such as described above.

    Any progress/tutorials on how to set up SilverStripe to handle "premium" content that is only viewable to registered (and logged in) viewers? With that in mind, I noted something about $LoginForm to create a login form. I wasn't clear whether this leads to the CMS or simply to functions/content that registered users have permission to access.

    Any direction would be appreciated! Thanks!

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Authentication / User Management in Silverstripe Link to this post

    Cheers, I hope you're having a good experience so far. You're fortunate that one of our Google Summer of Code projects is adding an intuitive user interface for this, requiring no PHP coding whatsoever, however while this code was recently (as in about two days ago) submitted to us, it won't be ready until the end of the Google Summer of Code project, which is a little over a month away.

    One easy way to see you through for the moment would be;

    1. create a new page type, such as SecuredPages, in which the init() contains your authentication, which only allows private access to all pages of this type

    2. you then add pages on your site as "SecuredPages", and setup a group, and add members to it.

    3. Have lots of fun and await the Google Summer of Code real thing

    Psuedocode for /code/SecuredPages.php

    <?php
    /**
    * Defines the SecuredPage page type
    */
    class SecuredPage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );

    static $allowed_children = array(
    );
    }

    class SecuredPage_Controller extends Page_Controller {
    function init() {
    if (**loggedInWithTheGroup('intranetUsers')** == false) {
    **Security:permissionfailure();**// look up actual function name
    }
    }
    }

    ?>

    The **** bits are not real, you need to code those The "if loggedInWithTheGroup" will actually probably be a few lines, let us know if you can't figure it ... you need to get current member, check isingroup, etc

  • Hani
    Avatar
    12 Posts

    Re: Authentication / User Management in Silverstripe Link to this post

    Thanks, Sigurd! I'll give that a whirl and see what I come up with.

    4093 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.