You are here

function configuration_user_role_update in Configuration Management 7

Implements hook_user_role_update().

We need to check all roles to see if something changed. If any names to roles changed or a tracked role was deleted, notify admin. The weight of a role is insignificant, if one role is missing or re-export everything.

File

observers/observer.user.inc, line 46
I'll probably end up putting this code in configuration.user.inc. Just want to keep it separate for now, while I get this working.

Code

function configuration_user_role_update($role) {
  module_load_include('inc', 'configuration', "configuration.export");

  // Set a static variable that we can access across this request.
  $a =& drupal_static('configuration_from_activestore');
  $a = TRUE;
  module_load_include('inc', 'configuration', "includes/configuration.user");
  configuration_check_user_role($role->name);
  configuration_write_export_file();

  // @todo: Think about how I can handle this better.  Do I really want to
  // rebuild cache everytime I make a change?
  cache_clear_all('config_export', 'cache');

  // Prime the cache.
  $configs = configuration_get_configuration();
}