mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
BUGFIX SiteTreeSubsites->canEdit() returns true if no subsites are defined (meaning it won't prevent editing, but the permission might still be denied by SiteTree->canEdit())
This commit is contained in:
parent
cf926b437b
commit
d0aafae7c5
@ -104,8 +104,14 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
* @return boolean
|
||||
*/
|
||||
function canEdit($member = null) {
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
||||
|
||||
// if no subsites exist, member can edit from a subsites perspective
|
||||
$allSubsites = DataObject::get('Subsite');
|
||||
if(!$allSubsites) return true;
|
||||
|
||||
// otherwise get all allowed subsites, and check if the subsite
|
||||
// this page belongs to is in the list
|
||||
$allowedSubsites = Subsite::getSubsitesForMember($member);
|
||||
if(
|
||||
!$allowedSubsites
|
||||
@ -121,7 +127,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
* @return boolean
|
||||
*/
|
||||
function canDelete($member = null) {
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
||||
|
||||
return $this->canEdit($member);
|
||||
}
|
||||
@ -130,7 +136,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
* @return boolean
|
||||
*/
|
||||
function canAddChildren($member = null) {
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
||||
|
||||
return $this->canEdit($member);
|
||||
}
|
||||
@ -139,7 +145,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
* @return boolean
|
||||
*/
|
||||
function canPublish($member = null) {
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
||||
|
||||
return $this->canEdit($member);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user