When a custom permission is added to a feature module, and the permission is selected (checked) when this feature is recreated, then the feature module will add itself as a dependency.

For example, when I create a permission this way:
function uw_ct_article_permission() {
$permissions = array();
$permissions['use workbench_moderation archive content tab'] = array(
'title' => t('Use "Archive Content" workbench tab'),
);
return $permissions;
}

the feature wants to make itself a dependency. please find the attached screenshot.

CommentFileSizeAuthor
uw1.png34.97 KBlily.yan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Should probably not be even allowed to select on the recreate form. Probably not a permission specific thing, _features_populate likely.

kpaxman’s picture

I think you need to be able to select the permission. You are creating the permission itself inside the feature, but you are configuring what roles are assigned to it in the GUI and exporting that configuration to the selfsame feature.

hefox’s picture

I mean, should not be able to select the current module as dependency imo

kpaxman’s picture

I just happened to be looking at features.user.inc and I see the following:

/**
 * Implements hook_features_export().
 */
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) {
    if (isset($map[$perm])) {
      $perm_module = $map[$perm];
      $export['dependencies'][$perm_module] = $perm_module;
      $export['features']['user_permission'][$perm] = $perm;
    }
  }

  return array();
}

If the if statement checked to make sure that $map[$perm] was not the name of the feature itself, this problem would probably go away. (But I haven't tried this as yet.)

hefox’s picture

Imo better to fix it in features.export.inc as other's might make the mistake, unset it it it's been added.

Nitebreed’s picture

Issue summary: View changes

Issue is still active imo.