You are here

function user_permission_features_export in Features 7.2

Same name and namespace in other branches
  1. 6 includes/features.user.inc \user_permission_features_export()
  2. 7 includes/features.user.inc \user_permission_features_export()

Implements hook_features_export().

File

includes/features.user.inc, line 35
Features integration for 'user' module.

Code

function user_permission_features_export($data, &$export, $module_name = '') {
  $export['dependencies']['features'] = 'features';

  // Ensure the modules that provide the given permissions are included as
  // dependencies.
  $map = user_permission_get_modules();
  foreach ($data as $perm) {
    $perm_name = $perm;

    // Export vocabulary permissions using the machine name, instead of
    // vocabulary id.
    _user_features_change_term_permission($perm_name, 'machine_name');
    if (isset($map[$perm_name])) {
      $perm_module = $map[$perm_name];
      $export['dependencies'][$perm_module] = $perm_module;
      $export['features']['user_permission'][$perm] = $perm;
    }
  }
  return array();
}