Jump to:

11003 Posts in 2735 Topics by 1824 members

All other Modules

SilverStripe Forums » All other Modules » SecureFiles 0.21 Released - Testers + Translations please!

Discuss all other Modules here.

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

Page: 1 2 3 4 5 6
Go to End
Author Topic: 5835 Views
  • Derek
    Avatar
    Community Member
    6 Posts

    Re: SecureFiles 0.21 Released - Testers + Translations please! Link to this post

    I'm wondering if it's possible to hide folders in the admin if the user who is logged in doesn't have access to the files. Would there be a way to change the root of the files folder according to the group logged in? A folder could be created for each group and this would become the root (instead of 'assets') for that group. The group could not see or edit their folder nor could they access files above their folder.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: SecureFiles 0.21 Released - Testers + Translations please! Link to this post

    Hamish, when I use $Link in my template to allow registered users to download a file, the filename contains the complete path (e.g. "assets-SecureFiles-SomeFolder-filename.doc"). Is there a way to prevent this from happening so that the filename is just "filename.doc"?

  • NicolasLeuenberger
    Avatar
    Community Member
    9 Posts

    Re: SecureFiles 0.21 Released - Testers + Translations please! Link to this post

    Hi Hamish

    I try to extend File as you suggest for granting access, but I'm not sure how to do that. I tried the following in mysite/code/CustomFile.php:

    class CustomFile extends File{
       function canViewSecured(){
          return true;
       }
    }

    Yes, I know, this would grant access to all files. It's not a finished class, but first I need to know whether the direction is right. Anyway. this example doesn't work. Any tipps?

    In the end I try to grant access to files that are attached to Pages only if the visitor has the right to view the page. It's for a member area.

    Any help is deeply appreciated.

    Nicolas

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: SecureFiles 0.21 Released - Testers + Translations please! Link to this post

    Hi Nicolas

    Almost, but instead of subclassing File you need to create a Decorator and apply it to the File object. For example, have a look at SecureFileMemberPermissionDecorator.php and how to apply decorators in _config.php.

    5835 Views
Page: 1 2 3 4 5 6
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.