Fallback to parent permissions

This commit is contained in:
Will Rossiter 2017-10-16 10:13:14 +13:00
parent 658b4dc02a
commit efae9a293e

View File

@ -142,10 +142,16 @@ class SubmittedForm extends DataObject
public function canView($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return $this->Parent()->canView();
if ($this->Parent()) {
return $this->Parent()->canView($member);
}
return parent::canView($member);
}
/**
@ -156,10 +162,16 @@ class SubmittedForm extends DataObject
public function canEdit($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return $this->Parent()->canEdit();
if ($this->Parent()) {
return $this->Parent()->canEdit($member);
}
return parent::canEdit($member);
}
/**
@ -170,15 +182,21 @@ class SubmittedForm extends DataObject
public function canDelete($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return $this->Parent()->canDelete();
if ($this->Parent()) {
return $this->Parent()->canDelete($member);
}
return parent::canDelete($member);
}
/**
* Before we delete this form make sure we delete all the
* field values so that we don't leave old data round
* Before we delete this form make sure we delete all the field values so
* that we don't leave old data round.
*
* @return void
*/