Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Correct way of setting security access to editors

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 3485 Views
  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Correct way of setting security access to editors Link to this post

    Thanks a lot, AlexBeka, your patch works for me, content admins can now see the translations (the sitetree in second ++ language). This saves me from some headache tomorrow

    For a better solution it would be nice if the content admin could actually use the language selector, and not have to switch translations using the translation tab in any of the translated pages.

    To my surprise the event calendar issue i see Event Calendar and Translatable - error adding announcements in second languageseems to be related, the patch seemed to have helped there too, halfway at least.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Correct way of setting security access to editors Link to this post

    I've made some commits to trunk in the last 24h which should fix this properly. There's now a TRANSLATE_ALL permission, or alternatively TRANSLATE_<locale> if Translate::set_allowed_locales() is used. You should be able to patch a 2.3 installation with those commits as well. open.ss.com is currently down, but the commits will show up in there soon: http://open.silverstripe.com/timeline

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Correct way of setting security access to editors Link to this post

    Thanks Ingo, that was fast

    I applied the changesets manually
    Changeset [88123] by ischommer
    Changeset [88125] by ischommer
    Changeset [88137] by ischommer
    Changeset [88138] by ischommer
    Changeset [88139] by ischommer

    and it works now, even content admins can switch Translations easily

    BTW, the Translatable.php as it is now on open.ss.com does not work for me, it's full with "SiteTree"."Locale" which mysql does not like, it wants `SiteTree`.`Locale`

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Correct way of setting security access to editors Link to this post

    You'll need 2.3.3 (and please read the upgrade notes on doc.ss.com carefully)

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Correct way of setting security access to editors Link to this post

    Ingo, yes, I applied your changesets to a vanilla 2.3.3 Translatable.php, and all is fine.

    However before I did that I took the Translatable.php from open.ss.com and that had these MySQL errors about "SiteTree"."Locale" (which mysql does not like, it wants `SiteTree`.`Locale`) however that's trunk and work in progress, so nevermind. The language / translation selection was our issue here, and that you fixed.

    Thanks again.

  • AlexBeka
    Avatar
    Community Member
    21 Posts

    Re: Correct way of setting security access to editors Link to this post

    thanks a lot for your changesets Ingo;

    i just commented out the following lines in constructor of LanguageDropDownField.php which you added in changeset 88138:

    foreach($usedLocalesWithTitle as $locale => $localeTitle) {
       if($instance && !$instance->canTranslate(null, $locale)) {
          unset($usedLocalesWithTitle[$locale]);
       }
    }


    because of the following behaviour:
    1.) added the user "EnglishTranslator" and given the group the permission to edit site content and to translate to english ('TRANSLATE_en_GB');
    2.) logging in with that user shows the german sitetree but in the dropdown is just "English (United Kingdom)" displayed, so the "wrong" language is displayed for the current sitetree; navigating through the german sitetree is also not possible because ajax is missing the locale from the dropdown;

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Correct way of setting security access to editors Link to this post

    AlexBeka, have you explicitely allowed languages? IIRC that was needed for me to overcome exactly the same issue you talk about. I assume that your default language is not set to English, but to German, then it would be like this in _config.php:

    Object::add_extension('SiteTree', 'Translatable');
    Translatable::set_default_locale('de_DE');
    $allowed_locales = array(
    'de_DE'
    'en_GB',
    );
    Translatable::set_allowed_locales($allowed_locales);

    That works for me, without having to uncomment these lines LanguageDropDownField.php

  • AlexBeka
    Avatar
    Community Member
    21 Posts

    Re: Correct way of setting security access to editors Link to this post

    my settings in _config.php are:

    Object::add_extension('SiteTree', 'Translatable');
    Translatable::set_default_locale('de_AT');
    Translatable::set_allowed_locales(array('de_AT', 'en_GB'));

    so i have explicitely defined the "allowed" languges; i am wondering Kalileo that you cannot reproduce my described steps:

    1.) added the user "EnglishTranslator" and given the group the permission to edit site content and to translate to english ('TRANSLATE_en_GB');
    2.) logging in with that user shows the german sitetree but in the dropdown is just "English (United Kingdom)" displayed, so the "wrong" language is displayed for the current sitetree; navigating through the german sitetree is also not possible because ajax is missing the locale from the dropdown;

    Kalileo, if you reproduce these steps you see in in the language dropdown of the sitetree still the german language (you are also using SS 2.3.3, isn´t it)? with the code of Ingo it shouldn´t be because in this foreach loop in LanguageDropdownField.php

    foreach($usedLocalesWithTitle as $locale => $localeTitle) {
       if($instance && !$instance->canTranslate(null, $locale)) {
          unset($usedLocalesWithTitle[$locale]);
       }
    }


    can_Translate will return false for "de_AT" locale and so it is removed from the $usedLocalesWithTitle array, if the user has just the permisision-code TRANSLATE_en_GB as in my testcase above defined;

    3485 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.