mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
FIX Do no provide input for canEdit or canPublish if no subsites exist
This commit is contained in:
parent
875f5519ed
commit
dc9d6de62d
@ -273,8 +273,10 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
* - Is in a group which has access to the subsite this page belongs to
|
* - Is in a group which has access to the subsite this page belongs to
|
||||||
* - Is in a group with edit permissions on the "main site"
|
* - Is in a group with edit permissions on the "main site"
|
||||||
*
|
*
|
||||||
* @param null $member
|
* If there are no subsites configured yet, this logic is skipped.
|
||||||
* @return bool
|
*
|
||||||
|
* @param Member|null $member
|
||||||
|
* @return bool|null
|
||||||
*/
|
*/
|
||||||
public function canEdit($member = null)
|
public function canEdit($member = null)
|
||||||
{
|
{
|
||||||
@ -282,6 +284,11 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
$member = Security::getCurrentUser();
|
$member = Security::getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not provide any input if there are no subsites configured
|
||||||
|
if (!Subsite::get()->count()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Find the sites that this user has access to
|
// Find the sites that this user has access to
|
||||||
$goodSites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true, 'all', $member)->column('ID');
|
$goodSites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true, 'all', $member)->column('ID');
|
||||||
|
|
||||||
@ -329,8 +336,8 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $member
|
* @param Member|null $member
|
||||||
* @return bool
|
* @return bool|null
|
||||||
*/
|
*/
|
||||||
public function canPublish($member = null)
|
public function canPublish($member = null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user