mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Merge pull request #369 from creative-commoners/pulls/2.0/fix-edit-check
FIX Do no provide input for canEdit or canPublish if no subsites exist
This commit is contained in:
commit
f19b82f029
@ -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 with edit permissions on the "main site"
|
||||
*
|
||||
* @param null $member
|
||||
* @return bool
|
||||
* If there are no subsites configured yet, this logic is skipped.
|
||||
*
|
||||
* @param Member|null $member
|
||||
* @return bool|null
|
||||
*/
|
||||
public function canEdit($member = null)
|
||||
{
|
||||
@ -282,6 +284,11 @@ class SiteTreeSubsites extends DataExtension
|
||||
$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
|
||||
$goodSites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true, 'all', $member)->column('ID');
|
||||
|
||||
@ -329,8 +336,8 @@ class SiteTreeSubsites extends DataExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $member
|
||||
* @return bool
|
||||
* @param Member|null $member
|
||||
* @return bool|null
|
||||
*/
|
||||
public function canPublish($member = null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user