mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2022 from willmorgan/patch-2
Allow canCreate to be extended via Object->extend
This commit is contained in:
commit
bf788c4bab
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user