You are here

function configuration_check_user_permission in Configuration Management 7

2 calls to configuration_check_user_permission()
configuration_user_permissions_update in observers/observer.user.inc
Submit handler for checking a diff on user permissions.
user_permission_configuration_rebuild in includes/configuration.user.inc
Implements hook_configuration_rebuild(). Iterate through default permissions and update the permissions map.

File

includes/configuration.user.inc, line 280

Code

function configuration_check_user_permission($identifier) {

  // Get static variable that we can access across this request.
  $from_activestore =& drupal_static('configuration_from_activestore');
  $component = 'user_permission';
  if (file_exists("config://configuration.user_permission.inc")) {

    // Load the current configuration file on disk
    include_once drupal_realpath("config://configuration.user_permission.inc");
    module_load_include('inc', 'configuration', "includes/configuration.user");
    module_load_include('inc', 'configuration', 'configuration.export');
    $config = configuration_get_configuration();
    $identifiers = is_array($identifier) ? $identifier : array(
      $identifier,
    );

    // Export the field we just saved and evaluate the export to $fields
    $code = user_permission_configuration_export_render('configuration', $identifiers);
    eval(array_pop($code));

    // Get the permissions on disk.
    $permissions_code = configuration_user_default_permissions();

    // If the activestore doesn't exist it is most likely because this configuration
    // only exists in code.
    if (empty($permissions)) {
      configuration_set_status($component, $identifier, CONFIGURATION_TRACKED_DATASTORE_ONLY);
    }

    // Compare what was just exported to what is on the file system.

    /**
     * @todo This code is reused in all component files.
     */
    foreach ($identifiers as $identifier) {
      configuration_update_component_status($component, $identifier, $permissions, $permissions_code, $from_activestore);
    }
  }
}