Installation error, adding non-existent permissions to a role is not allowed

Created on 30 April 2024, 7 months ago
Updated 16 September 2024, 2 months ago

Problem/Motivation

Steps to reproduce

Fresh install of Drupal using 'composer create-project drupal/recommended-project'
on 'drush en commerce_marketplace' it trows this error

In Role.php line 207
Adding non-existent permissions to a role is not allowed. The incorrect permissions are "access commerce_promotion overview", "access in-place editing", "access tour", "administer commerce_promotion", "administer swiftmailer", "administer_mailsystem",
"create commerce_promotion", "delete commerce_promotion", "update commerce_promotion", "view any commerce_store", "view commerce_promotion".

In case I manually create the 'commerce_marketplace_owner' and 'commerce_marketplace_admin' before enabling the module it trows this error:

In PreExistingConfigException.php line 65:

Configuration objects (user.role.commerce_marketplace_admin, user.role.commerce_marketplace_owner) provided by commerce_marketplace already exist in active configuration

Proposed resolution

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇷🇴Romania alexberendei

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @alexberendei
  • 🇷🇴Romania alexberendei

    I've commented out the permissions that trows that error

    • commerce_marketplace/config/install/user.role.commerce_marketplace_owner.yml
    • commerce_marketplace/config/install/user.role.commerce_marketplace_admin.yml

    user.role.commerce_marketplace_owner.yml

    langcode: en
    status: true
    dependencies: {  }
    id: commerce_marketplace_owner
    label: 'Marketplace owner'
    is_admin: null
    permissions:
      # - 'access cart'
      - 'access checkout'
      - 'access comments'
      - 'access content'
      - 'access site-wide contact form'
      - 'search content'
      - 'view own customer profile'
      - 'view commerce_store'
      - 'view commerce_product'
      - 'view own unpublished commerce_product'
      - 'view own commerce_order'
      - 'manage own commerce_payment_method'
    

    user.role.commerce_marketplace_admin.yml

    langcode: en
    status: true
    dependencies: {  }
    id: commerce_marketplace_admin
    label: 'Marketplace admin'
    is_admin: null
    permissions:
      - 'access administration pages'
      - 'access commerce administration pages'
      - 'access commerce_order overview'
      - 'access commerce_product overview'
      - 'access commerce_product_attribute overview'
      # - 'access commerce_promotion overview'
      - 'access commerce_store overview'
      - 'access content overview'
      - 'access contextual links'
      - 'access in-place editing'
      - 'access profile overview'
      - 'access site in maintenance mode'
      # - 'access site reports'
      - 'access toolbar'
      # - 'access tour'
      - 'access user contact forms'
      - 'access user profiles'
      - 'administer block_content display'
      - 'administer block_content fields'
      - 'administer block_content form display'
      - 'administer blocks'
      - 'administer comment display'
      - 'administer comment fields'
      - 'administer comment form display'
      - 'administer comment types'
      - 'administer comments'
      - 'administer commerce_checkout_flow'
      - 'administer commerce_currency'
      - 'administer commerce_order'
      - 'administer commerce_order display'
      - 'administer commerce_order fields'
      - 'administer commerce_order form display'
      - 'administer commerce_order_item display'
      - 'administer commerce_order_item fields'
      - 'administer commerce_order_item form display'
      - 'administer commerce_order_type'
      - 'administer commerce_payment'
      - 'administer commerce_payment_gateway'
      - 'administer commerce_payment_method'
      - 'administer commerce_product'
      - 'administer commerce_product display'
      - 'administer commerce_product fields'
      - 'administer commerce_product form display'
      - 'administer commerce_product_attribute'
      - 'administer commerce_product_attribute_value display'
      - 'administer commerce_product_attribute_value fields'
      - 'administer commerce_product_attribute_value form display'
      - 'administer commerce_product_type'
      - 'administer commerce_product_variation display'
      - 'administer commerce_product_variation fields'
      - 'administer commerce_product_variation form display'
      # - 'administer commerce_promotion'
      # - 'administer commerce_store'
      - 'administer commerce_store display'
      - 'administer commerce_store fields'
      - 'administer commerce_store form display'
      - 'administer commerce_store_type'
      - 'administer commerce_tax_type'
      - 'administer contact forms'
      - 'administer contact_message display'
      - 'administer contact_message fields'
      - 'administer contact_message form display'
      - 'administer content types'
      - 'administer display modes'
      - 'administer image styles'
      - 'administer menu'
      - 'administer node display'
      - 'administer node fields'
      - 'administer node form display'
      - 'administer nodes'
      - 'administer profile'
      - 'administer profile display'
      - 'administer profile fields'
      - 'administer profile form display'
      - 'administer profile types'
      - 'administer search'
      - 'administer shortcuts'
      # - 'administer swiftmailer'
      - 'administer taxonomy'
      - 'administer taxonomy_term display'
      - 'administer taxonomy_term fields'
      - 'administer taxonomy_term form display'
      - 'administer url aliases'
      - 'administer user display'
      - 'administer user form display'
      - 'administer views'
      # - 'administer_mailsystem'
      - 'bypass node access'
      - 'change own username'
      - 'create article content'
      - 'create commerce_product_attribute'
      # - 'create commerce_promotion'
      - 'create customer profile'
      - 'create default commerce_order'
      - 'create page content'
      - 'customize shortcut links'
      - 'delete any article content'
      - 'delete any customer profile'
      - 'delete any page content'
      - 'delete article revisions'
      - 'delete commerce_product_attribute'
      # - 'delete commerce_promotion'
      - 'delete default commerce_order'
      - 'delete own article content'
      - 'delete own customer profile'
      - 'delete own page content'
      - 'delete page revisions'
      - 'delete terms in tags'
      - 'edit any article content'
      - 'edit any page content'
      - 'edit own article content'
      - 'edit own comments'
      - 'edit own page content'
      - 'edit terms in tags'
      - 'revert article revisions'
      - 'revert page revisions'
      - 'view page revisions'
      - 'switch shortcut sets'
      - 'update any customer profile'
      - 'update commerce_product_attribute'
      # - 'update commerce_promotion'
      - 'update default commerce_order'
      - 'update own customer profile'
      - 'use advanced search'
      - 'use text format basic_html'
      - 'use text format full_html'
      - 'use text format restricted_html'
      - 'view all revisions'
      # - 'view any commerce_store'
      - 'view any customer profile'
      - 'view any profile'
      - 'view article revisions'
      - 'view commerce_order'
      - 'view commerce_product_attribute'
      # - 'view commerce_promotion'
      - 'view page revisions'
      - 'view the administration theme'
    

    In my case the error was because
    - commerce_promotion was not enabled
    - swiftmailer ( I don't used it anymore in D10 )

  • 🇩🇪Germany fsnet

    In my opinion the module should only assign permissions related to other modules listed as dependencies in the info.yml.
    So either all related modules should be listed as dependencies or the permissions should be removed from the install file.

    Apart from this consideration there are permission that were removed from commerce (e.g. 'access cart') or are related to deprecated/unsupported modules (e.g. 'administer swiftmailer').

Production build 0.71.5 2024