mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
a7d39ef9c1
commit
1ad6130b64
@ -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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user