mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE: Added canDeleteFromLive permission to SiteTree, separate from canPublish (from r93315) (from r96756)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102388 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6167cad850
commit
bed078c16d
@ -919,6 +919,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
return $this->canEdit($member);
|
return $this->canEdit($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canDeleteFromLive($member = null) {
|
||||||
|
// If we have a result, then that means at least one decorator specified canDeleteFromLive
|
||||||
|
// Allow the permission check only if *all* voting decorators allow it.
|
||||||
|
$results = $this->extend('canDeleteFromLive', $member);
|
||||||
|
if($results && is_array($results)) if(!min($results)) return false;
|
||||||
|
|
||||||
|
return $this->canPublish($member);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stub method to get the site config, provided so it's easy to override
|
* Stub method to get the site config, provided so it's easy to override
|
||||||
*/
|
*/
|
||||||
@ -1943,7 +1952,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @uses SiteTreeDecorator->onAfterUnpublish()
|
* @uses SiteTreeDecorator->onAfterUnpublish()
|
||||||
*/
|
*/
|
||||||
function doUnpublish() {
|
function doUnpublish() {
|
||||||
if (!$this->canPublish()) return false;
|
if (!$this->canDeleteFromLive()) return false;
|
||||||
|
|
||||||
$this->extend('onBeforeUnpublish');
|
$this->extend('onBeforeUnpublish');
|
||||||
|
|
||||||
@ -2015,6 +2024,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
Versioned::reading_stage($origStage);
|
Versioned::reading_stage($origStage);
|
||||||
|
|
||||||
$this->extend('onAfterUnpublish');
|
$this->extend('onAfterUnpublish');
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user