diff --git a/core/model/Translatable.php b/core/model/Translatable.php index 6db33f385..ade3671db 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -129,7 +129,8 @@ * *

Permissions

* - * Authors without administrative access need special permissions. + * Authors without administrative access need special permissions to edit locales other than + * the default locale. * * - TRANSLATE_ALL: Translate into all locales * - Translate_: Translate a specific locale. Only available for all locales set in @@ -1146,8 +1147,12 @@ class Translatable extends DataObjectDecorator implements PermissionProvider { !is_array(self::get_allowed_locales()) || in_array($locale, self::get_allowed_locales()) ); + if(!$allowedLocale) return false; + // By default, anyone who can edit a page can edit the default locale + if($locale == self::default_locale()) return true; + // check for generic translation permission if(Permission::checkMember($member, 'TRANSLATE_ALL')) return true; diff --git a/tests/SiteTreeActionsTest.php b/tests/SiteTreeActionsTest.php index f63dbf339..da101754d 100644 --- a/tests/SiteTreeActionsTest.php +++ b/tests/SiteTreeActionsTest.php @@ -89,7 +89,7 @@ class SiteTreeActionsTest extends FunctionalTest { $page->CanEditType = 'LoggedInUsers'; $page->write(); $page->doPublish(); - + $actionsArr = $page->getCMSActions()->column('Name'); $this->assertContains('action_save',$actionsArr); @@ -116,6 +116,7 @@ class SiteTreeActionsTest extends FunctionalTest { // Get the live version of the page $page = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID"); + $this->assertType('SiteTree', $page); $actionsArr = $page->getCMSActions()->column('Name');