From 176a865dc4d8a8a509c15affece6abfba8f4586b Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 17 Nov 2008 02:24:18 +0000 Subject: [PATCH] Boundary condition check for top-level pages with 'inherit' permission git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66008 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/SiteTree.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 2e872b799..fec7f499d 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -609,15 +609,14 @@ class SiteTree extends DataObject { if($results && is_array($results)) if(!min($results)) return false; // check for empty spec - if( - !$this->CanViewType || $this->CanViewType == 'Anyone' - ) return true; + if(!$this->CanViewType || $this->CanViewType == 'Anyone') return true; // check for inherit - if( - $this->CanViewType == 'Inherit' && $this->Parent() - ) return $this->Parent()->canView($member); - + if($this->CanViewType == 'Inherit') { + if($this->ParentID) return $this->Parent()->canView($member); + else return true; + } + // check for any logged-in users if( $this->CanViewType == 'LoggedInUsers' @@ -743,14 +742,13 @@ class SiteTree extends DataObject { if(!$this->canView()) return false; // check for empty spec - if( - !$this->CanEditType || $this->CanEditType == 'Anyone' - ) return true; + if(!$this->CanEditType || $this->CanEditType == 'Anyone') return true; // check for inherit - if( - $this->CanEditType == 'Inherit' && $this->Parent() - ) return $this->Parent()->canEdit($member); + if($this->CanEditType == 'Inherit') { + if($this->ParentID) return $this->Parent()->canEdit($member); + else return Permission::checkMember("CMS_ACCESS_CMSMain"); + } // check for any logged-in users if(