Skip to content

Commit

Permalink
FIX allow extensions to modify canXYZ methods
Browse files Browse the repository at this point in the history
* Resolves #29
* Use extendedCan() instead of parent::canXYZ
  • Loading branch information
robbieaverill committed Jun 8, 2016
1 parent 354d24f commit 2a56498
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion code/models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,37 @@ public function getCMSTitle()

public function canView($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member);
}

public function canEdit($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member);
}

public function canDelete($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member);
}

public function canCreate($member = null)
{
$extended = $this->extendedCan(__FUNCTION__, $member);
if ($extended !== null) {
return $extended;
}
return Permission::check('CMS_ACCESS_CMSMain', 'any', $member);
}

Expand All @@ -229,7 +245,8 @@ public function getPage()
*
* @return HTML
*/
public function forTemplate($holder = true) {
public function forTemplate($holder = true)
{
return $this->renderWith($this->class);
}

Expand Down

0 comments on commit 2a56498

Please sign in to comment.