Add Permissions for user roles to Varbase Components from scanned config/permissions directory

Created on 27 February 2023, over 1 year ago
Updated 30 May 2023, over 1 year ago

Problem/Motivation

Permissions must exist

Invalid permissions will trigger runtime exceptions in Drupal 10 . Permissions should be defined in a permissions.yml file or a permission callback.

The skip_missing_permission_deprecation flag that was added in Drupal 9 to the Role entity in #2571235: [regression] Roles should depend on objects that are building the granted permissions .

Modules cannot be in a disabled state anymore, only installed and uninstalled
#1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed

  # A special flag so we can migrate permissions that do not exist yet.
  # @todo Remove in https://www.drupal.org/project/drupal/issues/2953111.
  skip_missing_permission_deprecation:
    plugin: default_value
    default_value: true

It was removed from the 10.0.x and 10.1.x branch.

#2953111: Only migrate role permissions that exist on the destination

Proposed resolution

User roles creation will have no permissions in them in Varbase Profile.

user.role.anonymous.yml
user.role.authenticated.yml
user.role.content_admin.yml
user.role.editor.yml
user.role.seo_admin.yml
user.role.site_admin.yml
user.role.administrator.yml

Add all default user permission configs for active user roles in the "config/permissions" folder in the module.

config/permissions/user.permissions.anonymous.yml
config/permissions/user.permissions.authenticated.yml
config/permissions/user.permissions.content_admin.yml
config/permissions/user.permissions.editor.yml
config/permissions/user.permissions.seo_admin.yml
config/permissions/user.permissions.site_admin.yml

With the list of all needed to grant Permissions after making sure all
dependencies for modules or dependencies on configs.

Following with the new Drupal 10 practice.

When the module is enabled the needed permissions will be granted to the active user role by:

  // Add permissions.
  ModuleInstallerFactory::addPermissions('MODULE_NAME');

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-10.0.0-alpha1 , varbase_components-2.0.0-alpha1

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3344804 : Added Permissions for user roles to Varbase Components from scanned config/permissions directory
📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

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

Comments & Activities

Production build 0.71.5 2024