Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

SecureFiles 0.21 Released - Testers + Translations please!

Go to End

44 Posts   10705 Views


Community Member, 6 Posts

2 April 2011 at 7:45am

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.


Community Member, 150 Posts

6 April 2011 at 4:32am

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"?


Community Member, 11 Posts

21 July 2011 at 8:06am

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.



Community Member, 712 Posts

22 July 2011 at 12:29pm

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.

Go to Top