mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Let users without a specific TRANSLATE_ permission edit the default locale, so that things don't break when you install the Translatabe module. (from r97267)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102435 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
36dbefedcf
commit
6eb4d67c86
@ -129,7 +129,8 @@
|
||||
*
|
||||
* <h2>Permissions</h2>
|
||||
*
|
||||
* 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_<locale>: Translate a specific locale. Only available for all locales set in
|
||||
@ -1153,8 +1154,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;
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user