I have a Feature that only contains roles and nothing else.

The roles are exported without the permissions per #2383439: User permission handling, which is absolutely fine.

However, the module gets loads of dependencies added, which a definitely not necessary just to create the role. They appear to be all the modules that provide all the permissions used on these roles, even though the permissions aren't actually included in the Feature!

The code that's stripping the permissions, should also strip the dependency information (assuming that's what's actually happening)

Issue fork features-2912545

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek created an issue. See original summary.

nedjo’s picture

Thanks for the report, a patch would be welcome.

nedjo’s picture

Status: Active » Postponed (maintainer needs more info)

I'm having trouble reproducing this.

I've configured a role with several permissions. Prior to exporting to Features, it looks like this:

langcode: en
status: true
dependencies: {  }
id: test_role
label: 'Test role'
weight: 3
is_admin: null
permissions:
  - 'administer comment types'
  - 'administer contact forms'
  - 'administer shortcuts'
  - 'administer url aliases'
  - 'administer views'

There are no dependencies listed. If I add only that role to a feature, only a dependency on 'user' is added to the .info.yml file. Maybe core's dependency assignment has changed?

Chris Burge’s picture

Status: Postponed (maintainer needs more info) » Active

This is reproducible. Steps to reproduce:

  1. Install Drupal 9.3 with Standard profile
  2. Enable the Features module
  3. Create a new feature called ‘Test Feature’
  4. Add the ‘Content editor’ role
  5. Write the feature to file
  6. Open /modules/custom/test_feature/config/install/user.role.content_editor.yml
  7. Observe the following:
langcode: en
status: true
dependencies:
  config:
    - node.type.article
    - node.type.page
    - taxonomy.vocabulary.tags
  module:
    - comment
    - contextual
    - file
    - node
    - path
    - system
    - taxonomy
    - toolbar
    - tour
id: content_editor
label: 'Content editor'
weight: 2
is_admin: false

Note that the role's dependencies are being exported.

If the role is stripped of its permissions, then it can't have dependencies; hence the bug.

nedjo’s picture

Status: Active » Needs review

k, makes sense. I've added a commit. I'm following what was introduced with permissions in #2757611: Permission export disabled, but import is not, unsetting dependencies rather than emptying. Manual testing would be welcome.