Jump to:

23581 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » Newbie advice, please...

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

Page: 1
Go to End
Author Topic: 627 Views
  • captain grimes
    Avatar
    Community Member
    1 Post

    Newbie advice, please... Link to this post

    Hi all - this is a very basic question indeed and I hope that someone can give me a steer on this. I need to put together a content managed site for a client and thought that SilverStripe might be a solution that would meet their requirements.
    What I'm not clear about is whether the specific piece of functionality that I need to offer the client can be met through SS, so I'm hoping that if someone's been down a similar route already they can give me a yes or no?
    The site will be for a pre-school group and among other things, the client wants to be able to upload material that is specific to each child and which can only be seen by the child's parents via a secure login. OK, I could spend some time putting this together in PHP/MySQL and set up a whole bunch of logins for different kids/parents, but I wondered if there was either this functionality built-in to SS that I can use straight out of the box, or an extension that could be uploaded that would help. From what I've seen I'm guessing that one way of doing this would be to set up each person as a separate user group with access only to a specific page or pages, but perhaps that's not the best/easiest way of doing this?
    I hope I've explained what I'm looking for here and that someone can point me in the right direction. Thanks in advance for any assistance/guidance.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Newbie advice, please... Link to this post

    Hi Capain Grimes,

    This sort of functionality is perfectly possible with SilverStripe, however it does require a certain amount of customization. SS will take care of all the authentication etc. but you will need to create the classes/db fields for your specific implementation.

    Here is a brief outline of how it might be done:

    1. Create a dataobject to hold each file and any accociated data.
    2. Decorate or extend Member class to have a has_many or many_many relationship to the above DataObject. This allows you to attach multiple files to an individual member. In this case it is probably best to extend member so that you can manage them in ModelAdmin. There is infact a great example of this functionality in the SilverStripe book.
    3. Create a member 'Account' page type which will allow members to login and view the files which are accociated with them. This would be done by creating a function in your controller to return the current members files, something like this:

    function getMembersFiles(){

    if($Member = Member::currentMember()){

    return $Member->FileObjects(); //Where FileObjects is the name of ur Relationship

    }

    }

    then in the CMS set that page to be only viewable by logged in users, or if you want more control do something like this in the template:

    <% if CurrentUser %>

    <% control MemberFiles %>
    $Something
    <% end_if %>

    <% else %>
    <p>Sorry you must be logged in to view this page, bla bla bla I can write what I want</p>
    <% end_if %

    Anyway I know that's not exactly a copy and paste solution, but hopefully it will give you enough info to get started Believe me, SilverStripe flexible enough to do almost anything with and it will continue to surprise you at how easily it lets you do it!

    Aram

    www.SSBits.com - SilverStripe Tutorials, Tips and other bits.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Newbie advice, please... Link to this post

    You could also download and install the Secure Files Module (http://silverstripe.org/secure-files/).
    I think it does exactly what you need?

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