Merge pull request #2022 from willmorgan/patch-2

Allow canCreate to be extended via Object->extend
This commit is contained in:
Ingo Schommer 2013-06-13 11:19:00 -07:00
commit bf788c4bab

View File

@ -2591,6 +2591,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return boolean * @return boolean
*/ */
public function canView($member = null) { public function canView($member = null) {
$extended = $this->extendedCan(__FUNCTION__, $member);
if($extended !== null) {
return $extended;
}
return Permission::check('ADMIN', 'any', $member); return Permission::check('ADMIN', 'any', $member);
} }
@ -2599,6 +2603,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return boolean * @return boolean
*/ */
public function canEdit($member = null) { public function canEdit($member = null) {
$extended = $this->extendedCan(__FUNCTION__, $member);
if($extended !== null) {
return $extended;
}
return Permission::check('ADMIN', 'any', $member); return Permission::check('ADMIN', 'any', $member);
} }
@ -2607,6 +2615,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return boolean * @return boolean
*/ */
public function canDelete($member = null) { public function canDelete($member = null) {
$extended = $this->extendedCan(__FUNCTION__, $member);
if($extended !== null) {
return $extended;
}
return Permission::check('ADMIN', 'any', $member); return Permission::check('ADMIN', 'any', $member);
} }
@ -2617,6 +2629,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return boolean * @return boolean
*/ */
public function canCreate($member = null) { public function canCreate($member = null) {
$extended = $this->extendedCan(__FUNCTION__, $member);
if($extended !== null) {
return $extended;
}
return Permission::check('ADMIN', 'any', $member); return Permission::check('ADMIN', 'any', $member);
} }