Skip to content

Commit

Permalink
0.30 Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishcampbell committed Apr 7, 2010
1 parent 5bfe0a6 commit 0b2701c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
27 changes: 27 additions & 0 deletions ChangeLog
@@ -0,0 +1,27 @@
0.30

- Added onAccessGranted and onAccessDenied hooks for File
- DateField compatibility fixes
- Member access token permission option
- Support for x-sendfile module and fread send method
- Added tests for basic operations
- Added buildtask to rebuild htaccess files
- Translations: German, Spanish, Finnish, French and Swedish

0.21

- Minor bugfix release

0.20

- Improved 2.4 compatibility
- Better i18n support
- Member permission option
- CMS administration improvements


0.10

- Initial release
- Abstracted security method
- Group permission option
22 changes: 17 additions & 5 deletions README
@@ -1,5 +1,5 @@
###############################################
Secure Files Module trunk
Secure Files Module 0.30
###############################################

A light-weight secure file provider.
Expand All @@ -20,12 +20,12 @@ http://polemic.net.nz/secure-files-module/?refer=docs
Installation Instructions
-----------------------------------------------
1. Extract the module to your website directory.

2. Run /dev/build?flush=1

3. Optionally apply the additional permission modes
listed in _config.php

Usage Overview
-----------------------------------------------
Adds a "Security" tab to the Folder options in
Expand All @@ -44,7 +44,7 @@ Recommendations
If you're using SilverStripe in rewriteless mode
(using the base index.php) or via IIS, DO NOT
USE THIS MODULE.

* Disable all Apache Option directives for your
asset folders from your Apache configuration
(eg httpd.conf). Prevents directory indexing,
Expand All @@ -59,7 +59,19 @@ Recommendations
headers with Secure Files by adding this to your
_config.php:
SecureFileController::use_x_sendfile_method();

Developer Tips
-----------------------------------------------

* Create new access methods by decorating File and
implementing the canViewSecured method. If it returns
true access to the file is granted.

* Hooks are provided for onAccessGranted and
onAccessDenied. Implement these methods in your
decorators to trigger actions when the file is
requested.

Disclaimer
-----------------------------------------------
ADDITIONAL COMMENTARY TO THE LICENSE DISCLAIMER:
Expand Down
10 changes: 7 additions & 3 deletions code/SecureFileController.php
Expand Up @@ -95,9 +95,13 @@ function handleAction() {
$file = File::find($file_path);

if($file instanceof File) {
return ($file->canView())
? $this->fileFound($file, $file_path)
: $this->fileNotAuthorized("Not Authorized");
if ($file->canView()) {
$file->extend('onAccessGranted');
return $this->fileFound($file, $file_path);
} else {
$file->extend('onAccessDenied');
return $this->fileNotAuthorized("Not Authorized");
}
} else {
return $this->fileNotFound("Not Found");
}
Expand Down

0 comments on commit 0b2701c

Please sign in to comment.