Jump to:

23358 Posts in 18066 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » _config.php Permission::check

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 910 Views
  • dacar
    Avatar
    Community Member
    168 Posts

    _config.php Permission::check Link to this post

    Hi,

    does anybody know, how to set a permission check in _config.php to give different settings to different groups?
    Permission::check doesn't work?

    if(Permission::check('administrators')) {
    HtmlEditorConfig::get('cms')->enablePlugins('safari','spellchecker','pagebreak','style','layer','table',
    'save','advhr','advimage','advlink','emotions','iespell','inlinepopups','insertdatetime','preview','media',
    'searchreplace','print','contextmenu','paste','directionality','fullscreen','noneditable','visualchars',
    'nonbreaking','xhtmlxtras','template');
    } else {

    }

    Greetings, Carsten

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: _config.php Permission::check Link to this post

    Well, if it's just the HTMLEditorConfig.

    There is a "HTML Editor Configuration" field in the permission tab in security to select the config for this group.... if you specified another HTMLEditorConfig in your _config.php:

    // default config
    HTMLEditorConfig::get('cms')->setOption('language','de');
    // config for group editors
    HTMLEditorConfig::get('reduced')->setOption('friendly_name','reduced');
    HTMLEditorConfig::get('reduced')->setButtonsForLine(1,'bold');

  • dacar
    Avatar
    Community Member
    168 Posts

    Re: _config.php Permission::check Link to this post

    Perfekto! Works great. But you have to be careful to enable the required plugins again.

    // config for group editors
    HtmlEditorConfig::get('reduced')->setOption('language', 'de');
    HtmlEditorConfig::get('reduced')->setOptions(array(
       'friendly_name' => 'Simple CMS',
       'priority' => '50',
       'mode' => 'none',
       'content_css' => 'themes/xxx/css/editor.css, '.(SSViewer::current_theme() ? THEMES_DIR . "/" . SSViewer::current_theme() : project()) . "/css/editor.css",
       'body_class' => 'content'
    ));
    HtmlEditorConfig::get('reduced')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js'));
    HTMLEditorConfig::get('reduced')->setOption('friendly_name','reduced');
    HtmlEditorConfig::get('reduced')->disablePlugins('safari','spellchecker','pagebreak','style','layer','table','save','advhr','advimage','emotions','iespell','inlinepopups','insertdatetime','preview','media','searchreplace','print','contextmenu','paste','directionality','fullscreen','noneditable','visualchars','nonbreaking','xhtmlxtras','template');
    HTMLEditorConfig::get('reduced')->setButtonsForLine(1,'save','bold','separator','cut','copy','paste','pastetext','pasteword','separator','bullist','numlist','separator','sslink','unlink','anchor');
    HtmlEditorConfig::get('reduced')->setButtonsForLine(2,'');


    Thanks a lot Devlin!

    910 Views
Page: 1
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.