MINOR: Fixed SiteTree::canEdit() for records not yet saved to DB (from r92193) (from r96745)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102372 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 02:35:43 +00:00
parent a7d39ef9c1
commit 1ad6130b64

View File

@ -869,15 +869,21 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$results = $this->extend('canEdit', $memberID);
if($results && is_array($results)) if(!min($results)) return false;
// Check cache (the can_edit_multiple call below will also do this, but this is quicker)
if(isset(self::$cache_permissions['edit'][$this->ID])) {
return self::$cache_permissions['edit'][$this->ID];
if($this->ID) {
// Check cache (the can_edit_multiple call below will also do this, but this is quicker)
if(isset(self::$cache_permissions['edit'][$this->ID])) {
return self::$cache_permissions['edit'][$this->ID];
}
// Regular canEdit logic is handled by can_edit_multiple
$results = self::can_edit_multiple(array($this->ID), $memberID);
return $results[$this->ID];
// Default for unsaved pages
} else {
return $this->SiteConfig->canEdit();
}
// Regular canEdit logic is handled by can_edit_multiple
$results = self::can_edit_multiple(array($this->ID), $memberID);
return $results[$this->ID];
}
/**