Fallback permission checking

This commit is contained in:
Will Rossiter 2017-10-16 14:24:51 +13:00
parent efae9a293e
commit 3ac2ac55b5
2 changed files with 16 additions and 8 deletions

View File

@ -446,7 +446,11 @@ class EmailRecipient extends DataObject
*/ */
public function canView($member = null) public function canView($member = null)
{ {
return $this->Form()->canView($member); if ($form = $this->Form()) {
return $form->canView($member);
}
return parent::canView($member);
} }
/** /**
@ -456,7 +460,11 @@ class EmailRecipient extends DataObject
*/ */
public function canEdit($member = null) public function canEdit($member = null)
{ {
return $this->Form()->canEdit($member); if ($form = $this->Form()) {
return $form->canEdit($member);
}
return parent::canEdit($member);
} }
/** /**
@ -469,7 +477,7 @@ class EmailRecipient extends DataObject
return $this->canEdit($member); return $this->canEdit($member);
} }
/* /**
* Determine if this recipient may receive notifications for this submission * Determine if this recipient may receive notifications for this submission
* *
* @param array $data * @param array $data

View File

@ -39,14 +39,14 @@ use SilverStripe\UserForms\Model\EditableFormField;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
/** /**
* Defines the user defined functionality to be applied to any * Defines the user defined functionality to be applied to any {@link DataObject}
* {@link DataObject}
* *
*/ */
trait UserForm { trait UserForm
{
/** /**
* Built in extensions required by this page * Built in extensions required by this page.
*
* @config * @config
* @var array * @var array
*/ */