mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: fixed canPublish() so it actually got the member if none was passed and fixed notice with $results not existing
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65242 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5f177b9f08
commit
bb20921fef
@ -713,7 +713,7 @@ class SiteTree extends DataObject {
|
||||
public function canEdit($member = null) {
|
||||
if(Permission::checkMember($member, "ADMIN")) return true;
|
||||
if(!$member) $member = Member::currentUser();
|
||||
|
||||
|
||||
// decorated access checks
|
||||
$args = array($member, true);
|
||||
$this->extend('alternateCanEdit', $args);
|
||||
@ -765,8 +765,9 @@ class SiteTree extends DataObject {
|
||||
public function canPublish($member = null) {
|
||||
// If we have a result, then that means at least one decorator specified alternateCanPublish
|
||||
// Allow the permission check only if *all* voting decorators allow it.
|
||||
if(!$member) $member = Member::currentUser();
|
||||
$results = $this->extend('alternateCanPublish', $member);
|
||||
if(is_array($results)) return min($results);
|
||||
if($results && is_array($results)) return min($results);
|
||||
|
||||
// Normal case
|
||||
return $this->canEdit();
|
||||
|
Loading…
Reference in New Issue
Block a user