Skip to content

Commit

Permalink
Created 0.10 tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishcampbell committed Jan 31, 2010
1 parent 09a5e83 commit fc097c7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################
Secure Files Module v trunk
Secure Files Module 0.10
###############################################

A light-weight secure file provider.
Expand All @@ -15,7 +15,7 @@ SilverStripe 2.3

Documentation
-----------------------------------------------
http://doc.silverstripe.com/doku.php?id=modules:securefiles
http://polemic.net.nz/secure-files-module/?refer=docs

Installation Instructions
-----------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions code/SecureFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/
class SecureFileController extends Controller implements PermissionProvider {

/**
* @var string htaccess file as set by apache config
*/
static $htaccess_file = ".htaccess";

/**
Expand Down
25 changes: 21 additions & 4 deletions code/SecureFileGroupPermissionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ function extraStatics() {
);
}

/**
* View permission check
*
* @param Member $member
* @return noolean
*/
function canView(Member $member = null) {
if($this->owner->basicViewChecks($member))
return true;
Expand All @@ -24,6 +30,11 @@ function canView(Member $member = null) {
return $member->inGroups($this->owner->AllGroupPermissions());
}

/**
* Collate permissions for this and all parent folders.
*
* @return DataObjectSet
*/
function AllGroupPermissions() {
$groupSet = new DataObjectSet();
$groups = $this->owner->GroupPermissions();
Expand All @@ -35,6 +46,11 @@ function AllGroupPermissions() {
return $groupSet;
}

/**
* Collage permissions for all parent folders
*
* @return DataObjectSet
*/
function InheritedGroupPermissions() {
if($this->owner->ParentID)
return $this->owner->Parent()->AllGroupPermissions();
Expand All @@ -43,8 +59,11 @@ function InheritedGroupPermissions() {
}

/**
* Security tab for folders
*/
* Adds group select fields to CMS
*
* @param FieldSet $fields
* @return void
*/
public function updateCMSFields(FieldSet &$fields) {

if(!($this->owner instanceof Folder) || !$this->owner->ID)
Expand All @@ -65,8 +84,6 @@ public function updateCMSFields(FieldSet &$fields) {
$InheritedGroupsField = new ReadonlyField("InheritedGroupPermissionsText", "Inherited Group Permissions", $fieldText);
$fields->addFieldToTab('Root.Security', $InheritedGroupsField);
}



}

Expand Down

0 comments on commit fc097c7

Please sign in to comment.