Turn off Design for a user group

Permalink 1 user found helpful
I've been watching the videos for "permissions" and advanced permissions but I can't seem to figure out how to turn off specific content block capabilities, specifically:

Design

Is there a way to turn this off for a given role?

I only see:
Read
Write
Approve
Delete
Admin

I've set in my config:
define('PERMISSIONS_MODEL', 'advanced');

 
andrew replied on at Permalink Reply
andrew
This isn't something you can easily do today (although with our advanced permissions revamp you will be able to do exactly that.)

You _can_ disable design at a site-wide level by adding

define('ENABLE_CUSTOM_DESIGN', false);


to your config/site.php and that will remove "Design" as an option globally.
nicolechung replied on at Permalink Reply
This works well for me.

Thanks
mkly replied on at Permalink Best Answer Reply
mkly
Depending how techy you want to get there is a file that you can create called /config/site_process.php

AFAIK you should be able to put this
$user = new User();
$group = Group::getByName('Awful Designers');
if($user->inGroup($group)) {
  define('ENABLE_CUSTOM_DESIGN', false);
}


site_process.php runs before the page is rendered.
nicolechung replied on at Permalink Reply
Haha funny (but true).

Does this slow down the site very much? I think not because it seems like a simple check but I thought I should ask.
andrew replied on at Permalink Reply
andrew
No, not really.
mkly replied on at Permalink Reply
mkly
idk. Good question. Although I just realized you would be exposing some more global variables I think so maybe wrap it up in a
$site_process = function() {
  $user = new User();
  $group = Group::getByName('Awful Designers');
  if($user->inGroup($group)) {
    define('ENABLE_CUSTOM_DESIGN', false);
  }
};
$site_process();

I'm not sure the best way to do closures in php in but something like that.
PatrickCassidy replied on at Permalink Reply
PatrickCassidy
Good info... But is there a way that you can do it to a specific block area? My example is I have a Header Nav area, I don't want the client to be able to play with design on this area, but I don't mind them using it on other areas? Cheers ;)